From a131d6100ca13b00721ea30e6ef0d5225002867e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 22 Nov 2019 09:24:55 +0100 Subject: Fix prefix determination for windeployqt'ed applications Qt5Core.dll of windeployqt'ed applications is right next to the executable, and the prefix is considered the directory where the application is located. QLibraryInfo of a relocatable Qt5Core.dll would return a wrong prefix (by default /..), because it determines the prefix with QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH (by default ".."). We now detect whether the executable was windeployqt'ed by checking whether Qt5Core.dll is next to the executable. However, we must not do that for applications in QT_HOST_BINS, because they are not windeployqt'ed and must still use the standard prefix. We detect this case by checking whether for Qt5Core.dll exists a corresponding Qt5Core.lib in the libdir below the detected prefix. Fixes: QTBUG-79318 Change-Id: I1c9b971b282c6b9b19a93f1819ba8aee74be5be4 Reviewed-by: Friedemann Kleint --- src/corelib/global/qlibraryinfo.cpp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 276741c9fb..8c3ed184ae 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -562,9 +562,31 @@ static QString getRelocatablePrefix() HMODULE hModule = getWindowsModuleHandle(); const int kBufferSize = 4096; wchar_t buffer[kBufferSize]; - const int pathSize = GetModuleFileName(hModule, buffer, kBufferSize); - if (pathSize > 0) - prefixPath = prefixFromQtCoreLibraryHelper(QString::fromWCharArray(buffer, pathSize)); + DWORD pathSize = GetModuleFileName(hModule, buffer, kBufferSize); + const QString qtCoreFilePath = QString::fromWCharArray(buffer, int(pathSize)); + const QString qtCoreDirPath = QFileInfo(qtCoreFilePath).absolutePath(); + pathSize = GetModuleFileName(NULL, buffer, kBufferSize); + const QString exeDirPath = QFileInfo(QString::fromWCharArray(buffer, int(pathSize))).absolutePath(); + if (QFileInfo(exeDirPath) == QFileInfo(qtCoreDirPath)) { + // QtCore DLL is next to the executable. This is either a windeployqt'ed executable or an + // executable within the QT_HOST_BIN directory. We're detecting the latter case by checking + // whether there's an import library corresponding to our QtCore DLL in PREFIX/lib. + const QString libdir = QString::fromLatin1( + qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); + const QLatin1Char slash('/'); + const QString qtCoreImpLibPath + = qtCoreDirPath + + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + + slash + libdir + + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + if (!QFileInfo::exists(qtCoreImpLibPath)) { + // We did not find a corresponding import library and conclude that this is a + // windeployqt'ed executable. + return exeDirPath; + } + } + if (!qtCoreFilePath.isEmpty()) + prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath); #else #error "The chosen platform / config does not support querying for a dynamic prefix." #endif -- cgit v1.2.3 From c33916a279ef5908e1ebd44644c873933f6a7c77 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 28 Nov 2019 13:38:28 +0100 Subject: Fix prefix determination for windeployqt'ed MinGW applications We hard-coded the assumption the import lib naming scheme is always basename + ".lib" which is wrong for MinGW. This amends commit a131d610. Fixes: QTBUG-80366 Change-Id: Ibefb8a54483cc62743b8783530644b03e720262c Reviewed-by: Ulf Hermann --- src/corelib/global/qlibraryinfo.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 8c3ed184ae..f0f77fe68e 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -574,11 +574,19 @@ static QString getRelocatablePrefix() const QString libdir = QString::fromLatin1( qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]); const QLatin1Char slash('/'); - const QString qtCoreImpLibPath - = qtCoreDirPath +#if defined(Q_CC_MINGW) + const QString implibPrefix = QStringLiteral("lib"); + const QString implibSuffix = QStringLiteral(".a"); +#else + const QString implibPrefix; + const QString implibSuffix = QStringLiteral(".lib"); +#endif + const QString qtCoreImpLibFileName = implibPrefix + + QFileInfo(qtCoreFilePath).completeBaseName() + implibSuffix; + const QString qtCoreImpLibPath = qtCoreDirPath + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH) + slash + libdir - + slash + QFileInfo(qtCoreFilePath).completeBaseName() + QLatin1String(".lib"); + + slash + qtCoreImpLibFileName; if (!QFileInfo::exists(qtCoreImpLibPath)) { // We did not find a corresponding import library and conclude that this is a // windeployqt'ed executable. -- cgit v1.2.3 From 6ec5a97ebbf65a9283a57b8e5f4192e7ec84a759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 28 Nov 2019 17:46:34 +0100 Subject: macOS: Harden screen handling logic when reconfiguring displays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When connecting/disconnecting/reconfiguring screens Qt needs to know about the changes before they are propagated by the OS in other ways, so that we can reflect the changes in the list of QScreens as soon as they happen. Unfortunately the canonical notifications for this in AppKit, NSApplicationDidChangeScreenParametersNotification, is delivered after AppKit itself reacts to the change, which results in receiving NSWindowDidChangeScreenNotification, NSWindowWillMoveNotification, and others, while the list of QScreens is stale. To work around this we adopted the lower layer Quartz Display Services API in 3976df2805 to notify us when there are changes to the screen configuration. Unfortunately the window server on macOS is not consistent in how it orders events during screen reconfiguration, and we can't rely on the NSScreen list being up to date when we get our callbacks from Quartz. To work around this we still hook into Quartz, so that we get the callbacks as early as possible, but then track the state of the AppKit NSScreen list and update our own QScreens as soon as we see a change. We now also include sleeping displays in the list of QScreens, which matches the behavior of NSScreen.screens. Similarly we exclude displays that are mirroring another display. Task-number: QTBUG-80193 Change-Id: I6b1958d6ee61373b2861e05a0d971d2300596f3e Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoascreen.h | 21 ++- src/plugins/platforms/cocoa/qcocoascreen.mm | 272 +++++++++++++++++++++------- 2 files changed, 225 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoascreen.h b/src/plugins/platforms/cocoa/qcocoascreen.h index 7ec9a2b5af..dcf6f1c753 100644 --- a/src/plugins/platforms/cocoa/qcocoascreen.h +++ b/src/plugins/platforms/cocoa/qcocoascreen.h @@ -53,9 +53,6 @@ class QCocoaIntegration; class QCocoaScreen : public QPlatformScreen { public: - static void initializeScreens(); - static void cleanupScreens(); - ~QCocoaScreen(); // ---------------------------------------------------- @@ -79,7 +76,6 @@ public: // ---------------------------------------------------- NSScreen *nativeScreen() const; - void updateProperties(); void requestUpdate(); void deliverUpdateRequests(); @@ -88,6 +84,7 @@ public: static QCocoaScreen *primaryScreen(); static QCocoaScreen *get(NSScreen *nsScreen); static QCocoaScreen *get(CGDirectDisplayID displayId); + static QCocoaScreen *get(CFUUIDRef uuid); static CGPoint mapToNative(const QPointF &pos, QCocoaScreen *screen = QCocoaScreen::primaryScreen()); static CGRect mapToNative(const QRectF &rect, QCocoaScreen *screen = QCocoaScreen::primaryScreen()); @@ -95,11 +92,23 @@ public: static QRectF mapFromNative(CGRect rect, QCocoaScreen *screen = QCocoaScreen::primaryScreen()); private: - QCocoaScreen(CGDirectDisplayID displayId); + static void initializeScreens(); + static void updateScreens(); + static void cleanupScreens(); + + static bool updateScreensIfNeeded(); + static NSArray *s_screenConfigurationBeforeUpdate; + static void add(CGDirectDisplayID displayId); + QCocoaScreen(CGDirectDisplayID displayId); + void update(CGDirectDisplayID displayId); void remove(); + bool isOnline() const; + bool isMirroring() const; + CGDirectDisplayID m_displayId = kCGNullDirectDisplay; + CGDirectDisplayID displayId() const { return m_displayId; } QRect m_geometry; QRect m_availableGeometry; @@ -116,6 +125,8 @@ private: dispatch_source_t m_displayLinkSource = nullptr; QAtomicInt m_pendingUpdates; + friend class QCocoaIntegration; + friend class QCocoaWindow; friend QDebug operator<<(QDebug debug, const QCocoaScreen *screen); }; diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm index bd5c95b9d0..e4dd4cf6c6 100644 --- a/src/plugins/platforms/cocoa/qcocoascreen.mm +++ b/src/plugins/platforms/cocoa/qcocoascreen.mm @@ -57,6 +57,7 @@ QT_BEGIN_NAMESPACE namespace CoreGraphics { Q_NAMESPACE enum DisplayChange { + ReconfiguredWithFlagsMissing = 0, Moved = kCGDisplayMovedFlag, SetMain = kCGDisplaySetMainFlag, SetMode = kCGDisplaySetModeFlag, @@ -71,73 +72,165 @@ namespace CoreGraphics { Q_ENUM_NS(DisplayChange) } +NSArray *QCocoaScreen::s_screenConfigurationBeforeUpdate = nil; + void QCocoaScreen::initializeScreens() { - uint32_t displayCount = 0; - if (CGGetActiveDisplayList(0, nullptr, &displayCount) != kCGErrorSuccess) - qFatal("Failed to get number of active displays"); - - CGDirectDisplayID activeDisplays[displayCount]; - if (CGGetActiveDisplayList(displayCount, &activeDisplays[0], &displayCount) != kCGErrorSuccess) - qFatal("Failed to get active displays"); - - for (CGDirectDisplayID displayId : activeDisplays) - QCocoaScreen::add(displayId); + updateScreens(); CGDisplayRegisterReconfigurationCallback([](CGDirectDisplayID displayId, CGDisplayChangeSummaryFlags flags, void *userInfo) { - if (flags & kCGDisplayBeginConfigurationFlag) - return; // Wait for changes to apply - Q_UNUSED(userInfo); - qCDebug(lcQpaScreen).verbosity(0).nospace() << "Display reconfiguration" - << " (" << QFlags(flags) << ")" - << " for displayId=" << displayId; - - QCocoaScreen *cocoaScreen = QCocoaScreen::get(displayId); + // Displays are reconfigured in batches, and we want to update our screens + // once a batch ends, so that all the states of the displays are up to date. + static int displayReconfigurationsInProgress = 0; + + const bool beforeReconfigure = flags & kCGDisplayBeginConfigurationFlag; + qCDebug(lcQpaScreen).verbosity(0).nospace() << "Display " << displayId + << (beforeReconfigure ? " about to reconfigure" : " was ") + << QFlags(flags) + << " with " << displayReconfigurationsInProgress + << " display configuration(s) in progress"; + + if (!flags) { + // CGDisplayRegisterReconfigurationCallback has been observed to be called + // with flags unset. This seems like a bug. The callback is not paired with + // a matching "completion" callback either, so we don't know whether to treat + // it as a begin or end of reconfigure. + return; + } - if ((flags & kCGDisplayAddFlag) || !cocoaScreen) { - if (!CGDisplayIsActive(displayId)) { - qCDebug(lcQpaScreen) << "Not adding inactive display" << displayId; - return; // Will be added when activated + if (beforeReconfigure) { + if (!displayReconfigurationsInProgress++) { + // There might have been a screen reconfigure before this that + // we didn't process yet, so do that now if that's the case. + updateScreensIfNeeded(); + + Q_ASSERT(!s_screenConfigurationBeforeUpdate); + s_screenConfigurationBeforeUpdate = NSScreen.screens; + qCDebug(lcQpaScreen, "Display reconfigure transaction started" + " with screen configuration %p", s_screenConfigurationBeforeUpdate); + + static void (^tryScreenUpdate)(); + tryScreenUpdate = ^void () { + qCDebug(lcQpaScreen) << "Attempting screen update from runloop block"; + if (!updateScreensIfNeeded()) + CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, tryScreenUpdate); + }; + CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, tryScreenUpdate); } - QCocoaScreen::add(displayId); - } else if ((flags & kCGDisplayRemoveFlag) || !CGDisplayIsActive(displayId)) { - cocoaScreen->remove(); } else { - // Detect changes to the primary screen immediately, instead of - // waiting for a display reconfigure with kCGDisplaySetMainFlag. - // This ensures that any property updates to the other screens - // will be in reference to the correct primary screen. - QCocoaScreen *mainDisplay = QCocoaScreen::get(CGMainDisplayID()); - if (QGuiApplication::primaryScreen()->handle() != mainDisplay) { - mainDisplay->updateProperties(); - qCInfo(lcQpaScreen) << "Primary screen changed to" << mainDisplay; - QWindowSystemInterface::handlePrimaryScreenChanged(mainDisplay); - if (cocoaScreen == mainDisplay) - return; // Already reconfigured - } + Q_ASSERT_X(displayReconfigurationsInProgress, "QCococaScreen", + "Display configuration transactions are expected to be balanced"); - cocoaScreen->updateProperties(); - qCInfo(lcQpaScreen).nospace() << "Reconfigured " << - (primaryScreen() == cocoaScreen ? "primary " : "") - << cocoaScreen; + if (!--displayReconfigurationsInProgress) { + qCDebug(lcQpaScreen) << "Display reconfigure transaction completed"; + // We optimistically update now, in case the NSScreens have changed + updateScreensIfNeeded(); + } } }, nullptr); + + static QMacNotificationObserver screenParameterObserver(NSApplication.sharedApplication, + NSApplicationDidChangeScreenParametersNotification, [&]() { + qCDebug(lcQpaScreen) << "Received screen parameter change notification"; + updateScreensIfNeeded(); // As a last resort we update screens here + }); +} + +bool QCocoaScreen::updateScreensIfNeeded() +{ + if (!s_screenConfigurationBeforeUpdate) { + qCDebug(lcQpaScreen) << "QScreens have already been updated, all good"; + return true; + } + + if (s_screenConfigurationBeforeUpdate == NSScreen.screens) { + qCDebug(lcQpaScreen) << "Still waiting for NSScreen configuration change"; + return false; + } + + qCDebug(lcQpaScreen, "NSScreen configuration changed to %p", NSScreen.screens); + updateScreens(); + + s_screenConfigurationBeforeUpdate = nil; + return true; +} + +/* + Update the list of available QScreens, and the properties of existing screens. + + At this point we rely on the NSScreen.screens to be up to date. +*/ +void QCocoaScreen::updateScreens() +{ + uint32_t displayCount = 0; + if (CGGetOnlineDisplayList(0, nullptr, &displayCount) != kCGErrorSuccess) + qFatal("Failed to get number of online displays"); + + QVector onlineDisplays(displayCount); + if (CGGetOnlineDisplayList(displayCount, onlineDisplays.data(), &displayCount) != kCGErrorSuccess) + qFatal("Failed to get online displays"); + + qCInfo(lcQpaScreen) << "Updating screens with" << displayCount + << "online displays:" << onlineDisplays; + + // TODO: Verify whether we can always assume the main display is first + int mainDisplayIndex = onlineDisplays.indexOf(CGMainDisplayID()); + if (mainDisplayIndex < 0) { + qCWarning(lcQpaScreen) << "Main display not in list of online displays!"; + } else if (mainDisplayIndex > 0) { + qCWarning(lcQpaScreen) << "Main display not first display, making sure it is"; + onlineDisplays.move(mainDisplayIndex, 0); + } + + for (CGDirectDisplayID displayId : onlineDisplays) { + Q_ASSERT(CGDisplayIsOnline(displayId)); + + if (CGDisplayMirrorsDisplay(displayId)) + continue; + + // A single physical screen can map to multiple displays IDs, + // depending on which GPU is in use or which physical port the + // screen is connected to. By mapping the display ID to a UUID, + // which are shared between displays that target the same screen, + // we can pick an existing QScreen to update instead of needlessly + // adding and removing QScreens. + QCFType uuid = CGDisplayCreateUUIDFromDisplayID(displayId); + Q_ASSERT(uuid); + + if (QCocoaScreen *existingScreen = QCocoaScreen::get(uuid)) { + existingScreen->update(displayId); + qCInfo(lcQpaScreen) << "Updated" << existingScreen; + if (CGDisplayIsMain(displayId) && existingScreen != qGuiApp->primaryScreen()->handle()) { + qCInfo(lcQpaScreen) << "Primary screen changed to" << existingScreen; + QWindowSystemInterface::handlePrimaryScreenChanged(existingScreen); + } + } else { + QCocoaScreen::add(displayId); + } + } + + for (QScreen *screen : QGuiApplication::screens()) { + QCocoaScreen *platformScreen = static_cast(screen->handle()); + if (!platformScreen->isOnline() || platformScreen->isMirroring()) + platformScreen->remove(); + } } void QCocoaScreen::add(CGDirectDisplayID displayId) { const bool isPrimary = CGDisplayIsMain(displayId); QCocoaScreen *cocoaScreen = new QCocoaScreen(displayId); - qCInfo(lcQpaScreen).nospace() << "Adding " << (isPrimary ? "new primary " : "") << cocoaScreen; + qCInfo(lcQpaScreen) << "Adding" << cocoaScreen + << (isPrimary ? "as new primary screen" : ""); QWindowSystemInterface::handleScreenAdded(cocoaScreen, isPrimary); } QCocoaScreen::QCocoaScreen(CGDirectDisplayID displayId) : QPlatformScreen(), m_displayId(displayId) { - updateProperties(); + update(m_displayId); m_cursor = new QCocoaCursor; } @@ -150,8 +243,6 @@ void QCocoaScreen::cleanupScreens() void QCocoaScreen::remove() { - m_displayId = kCGNullDirectDisplay; // Prevent stale references during removal - // This may result in the application responding to QGuiApplication::screenRemoved // by moving the window to another screen, either by setGeometry, or by setScreen. // If the window isn't moved by the application, Qt will as a fallback move it to @@ -163,7 +254,7 @@ void QCocoaScreen::remove() // QCocoaWindow::windowDidChangeScreen. At that point the window will appear to have // already changed its screen, but that's only true if comparing the Qt screens, // not when comparing the NSScreens. - qCInfo(lcQpaScreen).nospace() << "Removing " << (primaryScreen() == this ? "current primary " : "") << this; + qCInfo(lcQpaScreen) << "Removing " << this; QWindowSystemInterface::handleScreenRemoved(this); } @@ -210,9 +301,14 @@ static QString displayName(CGDirectDisplayID displayID) return QString(); } -void QCocoaScreen::updateProperties() +void QCocoaScreen::update(CGDirectDisplayID displayId) { - Q_ASSERT(m_displayId); + if (displayId != m_displayId) { + qCDebug(lcQpaScreen) << "Reconnecting" << this << "as display" << displayId; + m_displayId = displayId; + } + + Q_ASSERT(isOnline()); const QRect previousGeometry = m_geometry; const QRect previousAvailableGeometry = m_availableGeometry; @@ -350,8 +446,8 @@ struct DeferredDebugHelper void QCocoaScreen::deliverUpdateRequests() { - if (!m_displayId) - return; // Screen removed + if (!isOnline()) + return; QMacAutoReleasePool pool; @@ -562,6 +658,29 @@ QPixmap QCocoaScreen::grabWindow(WId view, int x, int y, int width, int height) return windowPixmap; } +bool QCocoaScreen::isOnline() const +{ + // When a display is disconnected CGDisplayIsOnline and other CGDisplay + // functions that take a displayId will not return false, but will start + // returning -1 to signal that the displayId is invalid. Some functions + // will also assert or even crash in this case, so it's important that + // we double check if a display is online before calling other functions. + auto isOnline = CGDisplayIsOnline(m_displayId); + static const uint32_t kCGDisplayIsDisconnected = int32_t(-1); + return isOnline != kCGDisplayIsDisconnected && isOnline; +} + +/* + Returns true if a screen is mirroring another screen +*/ +bool QCocoaScreen::isMirroring() const +{ + if (!isOnline()) + return false; + + return CGDisplayMirrorsDisplay(m_displayId); +} + /*! The screen used as a reference for global window geometry */ @@ -586,6 +705,12 @@ QList QCocoaScreen::virtualSiblings() const QCocoaScreen *QCocoaScreen::get(NSScreen *nsScreen) { + if (s_screenConfigurationBeforeUpdate) { + qCWarning(lcQpaScreen) << "Trying to resolve screen while waiting for screen reconfigure!"; + if (!updateScreensIfNeeded()) + qCWarning(lcQpaScreen) << "Failed to do last minute screen update. Expect crashes."; + } + return get(nsScreen.qt_displayId); } @@ -600,23 +725,34 @@ QCocoaScreen *QCocoaScreen::get(CGDirectDisplayID displayId) return nullptr; } +QCocoaScreen *QCocoaScreen::get(CFUUIDRef uuid) +{ + for (QScreen *screen : QGuiApplication::screens()) { + auto *platformScreen = static_cast(screen->handle()); + if (!platformScreen->isOnline()) + continue; + + auto displayId = platformScreen->displayId(); + QCFType candidateUuid(CGDisplayCreateUUIDFromDisplayID(displayId)); + Q_ASSERT(candidateUuid); + + if (candidateUuid == uuid) + return platformScreen; + } + + return nullptr; +} + NSScreen *QCocoaScreen::nativeScreen() const { if (!m_displayId) return nil; // The display has been disconnected - // A single display may have different displayIds depending on - // which GPU is in use or which physical port the display is - // connected to. By comparing UUIDs instead of display IDs we - // ensure that we always pick up the appropriate NSScreen. - QCFType uuid = CGDisplayCreateUUIDFromDisplayID(m_displayId); - - for (NSScreen *screen in [NSScreen screens]) { - if (QCFType(CGDisplayCreateUUIDFromDisplayID(screen.qt_displayId)) == uuid) + for (NSScreen *screen in NSScreen.screens) { + if (screen.qt_displayId == m_displayId) return screen; } - qCWarning(lcQpaScreen) << "Could not find NSScreen for display ID" << m_displayId; return nil; } @@ -651,11 +787,21 @@ QDebug operator<<(QDebug debug, const QCocoaScreen *screen) debug.nospace(); debug << "QCocoaScreen(" << (const void *)screen; if (screen) { - debug << ", geometry=" << screen->geometry(); + debug << ", " << screen->name(); + if (screen->isOnline()) { + if (CGDisplayIsAsleep(screen->displayId())) + debug << ", Sleeping"; + if (auto mirroring = CGDisplayMirrorsDisplay(screen->displayId())) + debug << ", mirroring=" << mirroring; + } else { + debug << ", Offline"; + } + debug << ", " << screen->geometry(); debug << ", dpr=" << screen->devicePixelRatio(); - debug << ", name=" << screen->name(); - debug << ", displayId=" << screen->m_displayId; - debug << ", native=" << screen->nativeScreen(); + debug << ", displayId=" << screen->displayId(); + + if (auto nativeScreen = screen->nativeScreen()) + debug << ", " << nativeScreen; } debug << ')'; return debug; -- cgit v1.2.3 From d027860201c55b686b9f8330c559f84799442d68 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 28 Nov 2019 18:36:48 +0200 Subject: Fix assets iterator - start from index -1 each time when we iterate. Each time when we add a FolderIterator to the stack we MUST reset the index (-1) otherwise it will continue from it's last position. To fix it we are cloning the FolderIterator to set the index to -1. The index must be -1 in order to set it to 0 when we first call next() method. - introduce "fileType" static method for a more reliable also much faster file type lookup. The old version of checking if a file exists, is a folder or a file was buggy that's why it skipped some file randomly. Fixes: QTBUG-80178 Change-Id: I4b28e4616399b1bff35d792b55ded1bf19b62dd9 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../android/qandroidassetsfileenginehandler.cpp | 70 +++++++++++++++++----- 1 file changed, 56 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp index 26e72a480f..3d16f96450 100644 --- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp +++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp @@ -72,9 +72,10 @@ static inline QString prefixedPath(QString path) struct AssetItem { enum class Type { File, - Folder + Folder, + Invalid }; - + AssetItem() = default; AssetItem (const QString &rawName) : name(rawName) { @@ -92,21 +93,47 @@ using AssetItemList = QVector; class FolderIterator : public AssetItemList { public: - static QSharedPointer fromCache(const QString &path) + static QSharedPointer fromCache(const QString &path, bool clone) { QMutexLocker lock(&m_assetsCacheMutex); QSharedPointer *folder = m_assetsCache.object(path); if (!folder) { folder = new QSharedPointer{new FolderIterator{path}}; - if (!m_assetsCache.insert(path, folder)) { + if ((*folder)->empty() || !m_assetsCache.insert(path, folder)) { QSharedPointer res = *folder; delete folder; return res; } } - return *folder; + return clone ? QSharedPointer{new FolderIterator{*(*folder)}} : *folder; + } + + static AssetItem::Type fileType(const QString &filePath) + { + const QStringList paths = filePath.split(QLatin1Char('/')); + QString fullPath; + AssetItem::Type res = AssetItem::Type::Invalid; + for (const auto &path: paths) { + auto folder = fromCache(fullPath, false); + auto it = std::lower_bound(folder->begin(), folder->end(), AssetItem{path}, [](const AssetItem &val, const AssetItem &assetItem) { + return val.name < assetItem.name; + }); + if (it == folder->end() || it->name != path) + return AssetItem::Type::Invalid; + if (!fullPath.isEmpty()) + fullPath.append(QLatin1Char('/')); + fullPath += path; + res = it->type; + } + return res; } + FolderIterator(const FolderIterator &other) + : AssetItemList(other) + , m_index(-1) + , m_path(other.m_path) + {} + FolderIterator(const QString &path) : m_path(path) { @@ -118,8 +145,12 @@ public: QJNIEnvironmentPrivate env; jobjectArray jFiles = static_cast(files.object()); const jint nFiles = env->GetArrayLength(jFiles); - for (int i = 0; i < nFiles; ++i) - push_back({QJNIObjectPrivate(env->GetObjectArrayElement(jFiles, i)).toString()}); + for (int i = 0; i < nFiles; ++i) { + AssetItem item{QJNIObjectPrivate(env->GetObjectArrayElement(jFiles, i)).toString()}; + insert(std::upper_bound(begin(), end(), item, [](const auto &a, const auto &b){ + return a.name < b.name; + }), item); + } } m_path = assetsPrefix + QLatin1Char('/') + m_path + QLatin1Char('/'); m_path.replace(QLatin1String("//"), QLatin1String("/")); @@ -169,7 +200,7 @@ public: const QString &path) : QAbstractFileEngineIterator(filters, nameFilters) { - m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(path))); + m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(path), true)); if (m_stack.last()->empty()) m_stack.pop_back(); } @@ -215,7 +246,7 @@ public: if (!res) return {}; if (res->second.type == AssetItem::Type::Folder) { - m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(currentFilePath()))); + m_stack.push_back(FolderIterator::fromCache(cleanedAssetPath(currentFilePath()), true)); if (m_stack.last()->empty()) m_stack.pop_back(); } @@ -305,12 +336,12 @@ public: FileFlags fileFlags(FileFlags type = FileInfoAll) const override { - FileFlags flags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag); + FileFlags commonFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm|ExistsFlag); + FileFlags flags; if (m_assetFile) - flags |= FileType; + flags = FileType | commonFlags; else if (m_isFolder) - flags |= DirectoryType; - + flags = DirectoryType | commonFlags; return type & flags; } @@ -341,9 +372,20 @@ public: void setFileName(const QString &file) override { + if (m_fileName == cleanedAssetPath(file)) + return; close(); m_fileName = cleanedAssetPath(file); - m_isFolder = !open(QIODevice::ReadOnly) && !FolderIterator::fromCache(m_fileName)->empty(); + switch (FolderIterator::fileType(m_fileName)) { + case AssetItem::Type::File: + open(QIODevice::ReadOnly); + break; + case AssetItem::Type::Folder: + m_isFolder = true; + break; + case AssetItem::Type::Invalid: + break; + } } Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override -- cgit v1.2.3 From a966a7b7df18ebf7b92409b1199386df7f872b6c Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Tue, 3 Dec 2019 09:25:06 +0200 Subject: Initialize all variables Set m_isFolder = false also in "close" method Fixes: QTBUG-80468 Change-Id: I5449692d61d4d340e83bdca337b86e054e8bf561 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp index 3d16f96450..fcc08ea00d 100644 --- a/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp +++ b/src/plugins/platforms/android/qandroidassetsfileenginehandler.cpp @@ -288,6 +288,7 @@ public: m_assetFile = 0; return true; } + m_isFolder = false; return false; } @@ -397,9 +398,9 @@ public: private: AAsset *m_assetFile = nullptr; - AAssetManager *m_assetManager; + AAssetManager *m_assetManager = nullptr; QString m_fileName; - bool m_isFolder; + bool m_isFolder = false; }; -- cgit v1.2.3 From 61f92c0bcedfaad1721bd1c985217c5271e9086c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 3 Dec 2019 09:02:15 +0100 Subject: Make sure documentation for VulkanMemoryAllocator 3rdparty code shows up There's no qt documentation module for 'qtrhi' - instead, it should be added to the qtgui documentation module. Fixes: QTBUG-80489 Change-Id: Iea61b907811cd2135c2f1258599d9868d2218679 Reviewed-by: Laszlo Agocs --- src/3rdparty/VulkanMemoryAllocator/qt_attribution.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json b/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json index 2548856ca7..0a5df738a8 100644 --- a/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json +++ b/src/3rdparty/VulkanMemoryAllocator/qt_attribution.json @@ -2,7 +2,7 @@ { "Id": "VulkanMemoryAllocator", "Name": "Vulkan Memory Allocator", - "QDocModule": "qtrhi", + "QDocModule": "qtgui", "Description": "Vulkan Memory Allocator", "QtUsage": "Memory management for the Vulkan backend of QRhi.", -- cgit v1.2.3 From 2a887a517eaaa2c5324aecf3b919899b7a86ff4a Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 6 Dec 2019 18:30:55 +0100 Subject: QCalendar: Optimize std::vector access As we assert on the size of the vector before accessing it, there is no point in using the checked at() method over operator[]. Besides, if at() throws, what are we going to do with the exception anyway. Incidentally, this also works around a compiler bug causing binary incompatibility in QtQml. Change-Id: I460e7514429daecabc304eb2c5f96ed715008b0a Fixes: QTBUG-80535 Reviewed-by: Volker Hilsheimer --- src/corelib/time/qcalendar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/time/qcalendar.cpp b/src/corelib/time/qcalendar.cpp index d308aeba2b..6a4623ce92 100644 --- a/src/corelib/time/qcalendar.cpp +++ b/src/corelib/time/qcalendar.cpp @@ -100,7 +100,7 @@ struct Registry { if (id == QCalendar::System::User) { byId.push_back(calendar); } else { - Q_ASSERT(byId.at(size_t(id)) == nullptr); + Q_ASSERT(byId[size_t(id)] == nullptr); byId[size_t(id)] = calendar; } if (id == QCalendar::System::Gregorian) { @@ -618,7 +618,7 @@ const QCalendarBackend *QCalendarBackend::fromEnum(QCalendar::System system) if (calendarRegistry.isDestroyed() || system == QCalendar::System::User) return nullptr; Q_ASSERT(calendarRegistry->byId.size() >= size_t(system)); - if (auto *c = calendarRegistry->byId.at(size_t(system))) + if (auto *c = calendarRegistry->byId[size_t(system)]) return c; switch (system) { case QCalendar::System::Gregorian: -- cgit v1.2.3 From 42aa740df72af0c14f19a498f779d130e8303e54 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Tue, 10 Dec 2019 09:00:11 +0100 Subject: rcc: Fix namespace handling for initializer rcc currently always writes the namespace mangling macros in both the initializer constructor and destructor. This patch add the missing handling of the --namespace option for that part of the generated code. [ChangeLog][Tools][rcc] rcc now generates correct code when using the --namespace option. Change-Id: I7e5e608eb0ad267d11d601fc69c1a87d3f655a6e Fixes: QTBUG-80649 Reviewed-by: hjk --- src/tools/rcc/rcc.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 9acbce25ff..7185219d34 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -1478,13 +1478,19 @@ bool RCCResourceLibrary::writeInitializer() writeString(" return 1;\n"); writeString("}\n\n"); - writeByteArray( - "namespace {\n" - " struct initializer {\n" - " initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n" - " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n" - " } dummy;\n" - "}\n"); + + writeString("namespace {\n" + " struct initializer {\n"); + + if (m_useNameSpace) { + writeByteArray(" initializer() { QT_RCC_MANGLE_NAMESPACE(" + initResources + ")(); }\n" + " ~initializer() { QT_RCC_MANGLE_NAMESPACE(" + cleanResources + ")(); }\n"); + } else { + writeByteArray(" initializer() { " + initResources + "(); }\n" + " ~initializer() { " + cleanResources + "(); }\n"); + } + writeString(" } dummy;\n" + "}\n"); } else if (m_format == Binary) { int i = 4; -- cgit v1.2.3 From bf65c277892f6f322fa689c06d81ba9b1d9a8038 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 2 Dec 2019 16:15:14 +0100 Subject: Fix more mis-handling of spaces in ISO date format strings ISO date format doesn't allow spaces within a date, although 3339 does allow a space to replace the T between date and time. Sixteen tests added to check this all failed. So clean up the handling of spaces in the parsing of ISO date-time strings. [ChangeLog][QtCore][QDateTime] ISO 8601: parsing of dates now requires a punctuator as separator (it previously allowed any non-digit; officially only a dash should be allowed) and parsing of date-times no longer tolerates spaces in the numeric fields: an internal space is only allowed in an ISO 8601 date-time as replacement for the T between date and time. Change-Id: I24d110e71d416ecef74e196d5ee270b59d1bd813 Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetime.cpp | 104 +++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 0d8aaabd2e..a8d643d483 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -1626,6 +1626,29 @@ qint64 QDate::daysTo(const QDate &d) const */ #if QT_CONFIG(datestring) +namespace { + +struct ParsedInt { int value = 0; bool ok = false; }; + +/* + /internal + + Read an int that must be the whole text. QStringRef::toInt() will ignore + spaces happily; but ISO date format should not. +*/ +ParsedInt readInt(QStringView text) +{ + ParsedInt result; + for (const auto &ch : text) { + if (ch.isSpace()) + return result; + } + result.value = QLocale::c().toInt(text, &result.ok); + return result; +} + +} + /*! Returns the QDate represented by the \a string, using the \a format given, or an invalid date if the string cannot be @@ -1677,17 +1700,18 @@ QDate QDate::fromString(const QString &string, Qt::DateFormat format) return QDate(year, month, day); } #endif // textdate - case Qt::ISODate: { - // Semi-strict parsing, must be long enough and have non-numeric separators - if (string.size() < 10 || string.at(4).isDigit() || string.at(7).isDigit() - || (string.size() > 10 && string.at(10).isDigit())) { - return QDate(); - } - const int year = string.midRef(0, 4).toInt(); - if (year <= 0 || year > 9999) - return QDate(); - return QDate(year, string.midRef(5, 2).toInt(), string.midRef(8, 2).toInt()); + case Qt::ISODate: + // Semi-strict parsing, must be long enough and have punctuators as separators + if (string.size() >= 10 && string.at(4).isPunct() && string.at(7).isPunct() + && (string.size() == 10 || !string.at(10).isDigit())) { + QStringView view(string); + const ParsedInt year = readInt(view.mid(0, 4)); + const ParsedInt month = readInt(view.mid(5, 2)); + const ParsedInt day = readInt(view.mid(8, 2)); + if (year.ok && year.value > 0 && year.value <= 9999 && month.ok && day.ok) + return QDate(year.value, month.value, day.value); } + break; } return QDate(); } @@ -2331,17 +2355,15 @@ static QTime fromIsoTimeString(QStringView string, Qt::DateFormat format, bool * *isMidnight24 = false; const int size = string.size(); - if (size < 5) + if (size < 5 || string.at(2) != QLatin1Char(':')) return QTime(); - const QLocale C(QLocale::c()); - bool ok = false; - int hour = C.toInt(string.mid(0, 2), &ok); - if (!ok) - return QTime(); - const int minute = C.toInt(string.mid(3, 2), &ok); - if (!ok) + ParsedInt hour = readInt(string.mid(0, 2)); + ParsedInt minute = readInt(string.mid(3, 2)); + if (!hour.ok || !minute.ok) return QTime(); + // FIXME: ISO 8601 allows [,.]\d+ after hour, just as it does after minute + int second = 0; int msec = 0; @@ -2361,44 +2383,56 @@ static QTime fromIsoTimeString(QStringView string, Qt::DateFormat format, bool * // will then be rounded up AND clamped to 999. const QStringView minuteFractionStr = string.mid(6, qMin(qsizetype(5), string.size() - 6)); - const long minuteFractionInt = C.toLong(minuteFractionStr, &ok); - if (!ok) + const ParsedInt parsed = readInt(minuteFractionStr); + if (!parsed.ok) return QTime(); - const float minuteFraction = double(minuteFractionInt) / (std::pow(double(10), minuteFractionStr.size())); + const float secondWithMs + = double(parsed.value) * 60 / (std::pow(double(10), minuteFractionStr.size())); - const float secondWithMs = minuteFraction * 60; - const float secondNoMs = std::floor(secondWithMs); - const float secondFraction = secondWithMs - secondNoMs; - second = secondNoMs; + second = std::floor(secondWithMs); + const float secondFraction = secondWithMs - second; msec = qMin(qRound(secondFraction * 1000.0), 999); - } else { + } else if (string.at(5) == QLatin1Char(':')) { // HH:mm:ss or HH:mm:ss.zzz - second = C.toInt(string.mid(6, qMin(qsizetype(2), string.size() - 6)), &ok); - if (!ok) + const ParsedInt parsed = readInt(string.mid(6, qMin(qsizetype(2), string.size() - 6))); + if (!parsed.ok) return QTime(); - if (size > 8 && (string.at(8) == QLatin1Char(',') || string.at(8) == QLatin1Char('.'))) { + second = parsed.value; + if (size <= 8) { + // No fractional part to read + } else if (string.at(8) == QLatin1Char(',') || string.at(8) == QLatin1Char('.')) { QStringView msecStr(string.mid(9, qMin(qsizetype(4), string.size() - 9))); - // toInt() ignores leading spaces, so catch them before calling it + bool ok = true; + // Can't use readInt() here, as we *do* allow trailing space - but not leading: if (!msecStr.isEmpty() && !msecStr.at(0).isDigit()) return QTime(); - // We do, however, want to ignore *trailing* spaces. msecStr = msecStr.trimmed(); - int msecInt = msecStr.isEmpty() ? 0 : C.toInt(msecStr, &ok); + int msecInt = msecStr.isEmpty() ? 0 : QLocale::c().toInt(msecStr, &ok); if (!ok) return QTime(); const double secondFraction(msecInt / (std::pow(double(10), msecStr.size()))); msec = qMin(qRound(secondFraction * 1000.0), 999); + } else { +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) // behavior change + // Stray cruft after date-time: tolerate trailing space, but nothing else. + for (const auto &ch : string.mid(8)) { + if (!ch.isSpace()) + return QTime(); + } +#endif } + } else { + return QTime(); } const bool isISODate = format == Qt::ISODate || format == Qt::ISODateWithMs; - if (isISODate && hour == 24 && minute == 0 && second == 0 && msec == 0) { + if (isISODate && hour.value == 24 && minute.value == 0 && second == 0 && msec == 0) { if (isMidnight24) *isMidnight24 = true; - hour = 0; + hour.value = 0; } - return QTime(hour, minute, second, msec); + return QTime(hour.value, minute.value, second, msec); } /*! -- cgit v1.2.3 From 382f1a221b353892844dc7b1495741c4669955e7 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 31 Oct 2019 12:26:00 +1000 Subject: wasm: fix getOpenFileContent doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callback should be named the same as the function expects Change-Id: I4ca73958313c93c0d68e7205d8641c4104247e0c Reviewed-by: Morten Johan Sørvig --- src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp index 7ccd827a04..4b4fb869f9 100644 --- a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp +++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp @@ -146,13 +146,13 @@ dialog.exec(); //! [14] //! [15] -auto fileOpenCompleted = [](const QString &fileName, const QByteArray &fileContent) { +auto fileContentReady = [](const QString &fileName, const QByteArray &fileContent) { if (fileName.isEmpty()) { // No file was selected } else { // Use fileName and fileContent } -} +}; QFileDialog::getOpenFileContent("Images (*.png *.xpm *.jpg)", fileContentReady); //! [15] -- cgit v1.2.3 From 6ffedc07a77a8e3d46851b74cf9456d5abf6f612 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Sat, 7 Dec 2019 00:05:47 +0100 Subject: PSQL: Optimize QPSQLResult::data() function for date and time types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor performance optimalizations: - No need to check if the date and time are correct because the QDate, QTime and QDateTime parsing functions already perform these checks - No need to add minute part to the UTC offset before parsing the date, because the QDateTime class can parse time zone offset both in form ±hh:mm and ±hh Change-Id: Id74b7ae075135c5c8cf420247c49b5f12fe88899 Reviewed-by: Edward Welbourne --- src/plugins/sqldrivers/psql/qsql_psql.cpp | 34 ++++++++----------------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 78ede6a0d3..e0f82eee73 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -692,40 +692,24 @@ QVariant QPSQLResult::data(int i) return dbl; } case QVariant::Date: - if (val[0] == '\0') { - return QVariant(QDate()); - } else { #if QT_CONFIG(datestring) - return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate)); + return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate)); #else - return QVariant(QString::fromLatin1(val)); + return QVariant(QString::fromLatin1(val)); #endif - } - case QVariant::Time: { - const QString str = QString::fromLatin1(val); + case QVariant::Time: #if QT_CONFIG(datestring) - if (str.isEmpty()) - return QVariant(QTime()); - else - return QVariant(QTime::fromString(str, Qt::ISODate)); + return QVariant(QTime::fromString(QString::fromLatin1(val), Qt::ISODate)); #else - return QVariant(str); + return QVariant(QString::fromLatin1(val)); #endif - } - case QVariant::DateTime: { - QString dtval = QString::fromLatin1(val); + case QVariant::DateTime: #if QT_CONFIG(datestring) - if (dtval.length() < 10) { - return QVariant(QDateTime()); - } else { - QChar sign = dtval[dtval.size() - 3]; - if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00"); - return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime()); - } + return QVariant(QDateTime::fromString(QString::fromLatin1(val), + Qt::ISODate).toLocalTime()); #else - return QVariant(dtval); + return QVariant(QString::fromLatin1(val)); #endif - } case QVariant::ByteArray: { size_t len; unsigned char *data = PQunescapeBytea((const unsigned char*)val, &len); -- cgit v1.2.3 From 0d4dea728ff3b7f15a7ddb22d94c54087e98f53d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 31 May 2019 15:52:52 -0700 Subject: MIME: Make the internal database direct content, not a Qt resource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This saves us from having to bootstrap rcc in regular (non-cross) compilations, as it can now link to QtCore. Actually un-bootstrapping rcc is left as an exercise for the reader. This commit discovered that MSVC cannot handle constexpr arrays bigger than 256 kB, at which point it simply starts claiming that the constant expressions using it are not constexpr. ICC has a similar problem at 64 kB, but it tells you why ("note: type "const unsigned char [65537]" too large for constant-expression evaluation"). Note also that this requires gzip or zstd to be in PATH for compression to happen. RCC linked to zlib, which is always present due to the bundled copy. gzip's presence is not likely to be a problem on Unix systems, but could be for Windows users, especially MSVC ones. If gzip is not present, QtCore's size will increase by about 1910 kB of read-only (sharable) data. Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242 Reviewed-by: Edward Welbourne --- src/corelib/mimetypes/mime/generate.bat | 73 +++++++++++++++++++++ src/corelib/mimetypes/mime/generate.pl | 113 ++++++++++++++++++++++++++++++++ src/corelib/mimetypes/mime/hexdump.ps1 | 43 ++++++++++++ src/corelib/mimetypes/mimetypes.pri | 29 +++++++- src/corelib/mimetypes/qmimedatabase.cpp | 11 +++- src/corelib/mimetypes/qmimeprovider.cpp | 95 +++++++++++++++++++++++++-- src/corelib/mimetypes/qmimeprovider_p.h | 11 ++++ src/src.pro | 4 +- 8 files changed, 366 insertions(+), 13 deletions(-) create mode 100644 src/corelib/mimetypes/mime/generate.bat create mode 100644 src/corelib/mimetypes/mime/generate.pl create mode 100644 src/corelib/mimetypes/mime/hexdump.ps1 (limited to 'src') diff --git a/src/corelib/mimetypes/mime/generate.bat b/src/corelib/mimetypes/mime/generate.bat new file mode 100644 index 0000000000..f63fc63693 --- /dev/null +++ b/src/corelib/mimetypes/mime/generate.bat @@ -0,0 +1,73 @@ +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: +:: Copyright (C) 2019 Intel Corporation. +:: Contact: https://www.qt.io/licensing/ +:: +:: This file is part of the tools applications of the Qt Toolkit. +:: +:: $QT_BEGIN_LICENSE:GPL-EXCEPT$ +:: Commercial License Usage +:: Licensees holding valid commercial Qt licenses may use this file in +:: accordance with the commercial license agreement provided with the +:: Software or, alternatively, in accordance with the terms contained in +:: a written agreement between you and The Qt Company. For licensing terms +:: and conditions see https://www.qt.io/terms-conditions. For further +:: information use the contact form at https://www.qt.io/contact-us. +:: +:: GNU General Public License Usage +:: Alternatively, this file may be used under the terms of the GNU +:: General Public License version 3 as published by the Free Software +:: Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +:: included in the packaging of this file. Please review the following +:: information to ensure the GNU General Public License requirements will +:: be met: https://www.gnu.org/licenses/gpl-3.0.html. +:: +:: $QT_END_LICENSE$ +:: +::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +@echo off +setlocal ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS +set me=%~dp0 + +:: Check if certain tools are in PATH +for %%C in (gzip.exe zstd.exe perl.exe) do set %%C=%%~$PATH:C + +:: If perl is in PATH, just let it do everything +if not "%perl.exe%" == "" goto PuntToPerl + +set COMPRESS= +set MACRO=MIME_DATABASE_IS_UNCOMPRESSED +if not "%gzip.exe%" == "" ( + set COMPRESS=gzip -9 + set MACRO=MIME_DATABASE_IS_GZIP +) + +:: Check if zstd support was enabled +if /i "%~1" == "--zstd" ( + shift + if not "%zstd.exe%" == "" ( + set COMPRESS=zstd -19 + set MACRO=MIME_DATABASE_IS_ZSTD + ) +) + +if not "%COMPRESS%" == "" goto CompressedCommon + +:: No Compression and no Perl +:: Just hex-dump with Powershell +powershell -ExecutionPolicy Bypass %me%hexdump.ps1 %1 %1 +exit /b %errorlevel% + +:CompressedCommon +:: Compress to a temporary file, then hex-dump using Powershell +echo #define %MACRO% +set tempfile=generate%RANDOM%.tmp +%COMPRESS% < %1 > %tempfile% +powershell -ExecutionPolicy Bypass %me%hexdump.ps1 %tempfile% %1 +del %tempfile% +exit /b %errorlevel% + +:PuntToPerl +perl %me%generate.pl %* +exit /b %errorlevel% diff --git a/src/corelib/mimetypes/mime/generate.pl b/src/corelib/mimetypes/mime/generate.pl new file mode 100644 index 0000000000..0f87d61f8e --- /dev/null +++ b/src/corelib/mimetypes/mime/generate.pl @@ -0,0 +1,113 @@ +#!/usr/bin/perl +############################################################################# +## +## Copyright (C) 2019 Intel Corporation. +## Contact: https://www.qt.io/licensing/ +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# +use strict; +use warnings; +use Config; +local $/; # Enable "slurp" mode + +sub checkCommand($) { + use File::Spec::Functions; + my $cmd = $_[0] . $Config{_exe}; + for my $path (path()) { + return 1 if -x catfile($path, $cmd); + } + return 0; +} + +my $data; +my $compress; +my $macro; +my $zlib = eval 'use Compress::Zlib; use IO::Compress::Gzip; return 1;'; +my $fname = shift @ARGV; + +if ($zlib) { + # Prefer internal zlib support (useful on Windows where gzip.exe isn't + # always presnet) + $macro = "MIME_DATABASE_IS_GZIP"; +} elsif (checkCommand("gzip")) { + # No builtin support for compression (old Perl?) + $compress = "gzip -c9"; + $macro = "MIME_DATABASE_IS_GZIP"; +} + +# Check if Qt is being built with zstd support +if ($fname eq "--zstd") { + $fname = shift @ARGV; + if (checkCommand("zstd")) { + $compress = "zstd -cq19 --single-thread"; + $macro = "MIME_DATABASE_IS_ZSTD"; + } +} + +# Check if xml (from xmlstarlet) is in $PATH +my $cmd; +if (checkCommand("xml")) { + # Minify the data before compressing + $cmd = "xml sel -D -B -t -c / $fname"; + $cmd .= "| $compress" if $compress; +} elsif ($compress) { + $cmd = "$compress < $fname" +} +if ($cmd) { + # Run the command and read everything + open CMD, "$cmd |"; + $data = ; + close CMD; + die("Failed to run $cmd") if ($? >> 8); +} else { + # No command, just read the file + open F, "<$fname"; + $data = ; + close F; +} + +# Do we need to compress with zlib? +if (!$compress && $zlib) { + $data = eval q{ + use Compress::Zlib; + use IO::Compress::Gzip qw(gzip); + my $compressed; + gzip \$data => \$compressed, + Minimal => 1, + Level => Z_BEST_COMPRESSION; + return $compressed; + }; +} + +# Now print as hex +printf "#define %s\n", $macro if $macro; +printf "static const unsigned char mimetype_database[] = {"; +my $i = 0; +map { + printf "\n " if $i++ % 12 == 0; + printf "0x%02x, ", ord $_ +} split //, $data; +printf "\n};\n"; +printf "static constexpr size_t MimeTypeDatabaseOriginalSize = %d;\n", + (stat $fname)[7]; diff --git a/src/corelib/mimetypes/mime/hexdump.ps1 b/src/corelib/mimetypes/mime/hexdump.ps1 new file mode 100644 index 0000000000..25ce8138fa --- /dev/null +++ b/src/corelib/mimetypes/mime/hexdump.ps1 @@ -0,0 +1,43 @@ +############################################################################# +## +## Copyright (C) 2019 Intel Corporation. +## Contact: https://www.qt.io/licensing/ +## +## This file is the build configuration utility of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +param([String]$path, [String]$orig) + +"static const unsigned char mimetype_database[] = {" +ForEach ($byte in Get-Content -Encoding byte -ReadCount 16 -path $path) { +# if (($byte -eq 0).count -ne 16) { + $hex = $byte | Foreach-Object { + " 0x" + ("{0:x}" -f $_).PadLeft( 2, "0" ) + "," + } + " $hex" +# } +} +"};" + +$file = Get-Childitem -file $orig +"static constexpr size_t MimeTypeDatabaseOriginalSize = " + $file.length + ";" diff --git a/src/corelib/mimetypes/mimetypes.pri b/src/corelib/mimetypes/mimetypes.pri index 62bbe348e4..8cbe7b69ae 100644 --- a/src/corelib/mimetypes/mimetypes.pri +++ b/src/corelib/mimetypes/mimetypes.pri @@ -21,5 +21,32 @@ qtConfig(mimetype) { mimetypes/qmimeglobpattern.cpp \ mimetypes/qmimeprovider.cpp - qtConfig(mimetype-database): RESOURCES += mimetypes/mimetypes.qrc + MIME_DATABASE = mimetypes/mime/packages/freedesktop.org.xml + OTHER_FILES += $$MIME_DATABASE + + qtConfig(mimetype-database) { + outpath = .rcc + debug_and_release { + CONFIG(debug, debug|release): outpath = .rcc/debug + else: outpath = .rcc/release + } + + mimedb.depends = $$PWD/mime/generate.pl + equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)|isEmpty(QMAKE_SH) { + mimedb.commands = cmd /c $$shell_path($$PWD/mime/generate.bat) + mimedb.depends += $$PWD/mime/generate.bat $$PWD/mime/hexdump.ps1 + } else { + mimedb.commands = perl $${mimedb.depends} + } + + qtConfig(zstd): mimedb.commands += --zstd + mimedb.commands += ${QMAKE_FILE_IN} > ${QMAKE_FILE_OUT} + + mimedb.output = $$outpath/qmimeprovider_database.cpp + mimedb.input = MIME_DATABASE + mimedb.variable_out = INCLUDED_SOURCES + QMAKE_EXTRA_COMPILERS += mimedb + INCLUDEPATH += $$outpath + unset(outpath) + } } diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp index 1fbcc31fae..10b2190966 100644 --- a/src/corelib/mimetypes/qmimedatabase.cpp +++ b/src/corelib/mimetypes/qmimedatabase.cpp @@ -102,13 +102,18 @@ void QMimeDatabasePrivate::loadProviders() const auto fdoIterator = std::find_if(mimeDirs.constBegin(), mimeDirs.constEnd(), [](const QString &mimeDir) -> bool { return QFileInfo::exists(mimeDir + QStringLiteral("/packages/freedesktop.org.xml")); } ); - if (fdoIterator == mimeDirs.constEnd()) - mimeDirs.prepend(QLatin1String(":/qt-project.org/qmime")); //qDebug() << "mime dirs:" << mimeDirs; Providers currentProviders; std::swap(m_providers, currentProviders); - m_providers.reserve(mimeDirs.size()); + + if (QMimeXMLProvider::InternalDatabaseAvailable && fdoIterator == mimeDirs.constEnd()) { + m_providers.reserve(mimeDirs.size() + 1); + m_providers.push_back(Providers::value_type(new QMimeXMLProvider(this, QMimeXMLProvider::InternalDatabase))); + } else { + m_providers.reserve(mimeDirs.size()); + } + for (const QString &mimeDir : qAsConst(mimeDirs)) { const QString cacheFile = mimeDir + QStringLiteral("/mime.cache"); QFileInfo fileInfo(cacheFile); diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index c61759025c..4aee772366 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -1,7 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2018 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure +** Copyright (C) 2019 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -45,6 +46,7 @@ #include "qmimemagicrulematcher_p.h" #include +#include #include #include #include @@ -52,12 +54,33 @@ #include #include -static void initResources() -{ #if QT_CONFIG(mimetype_database) - Q_INIT_RESOURCE(mimetypes); +# if defined(Q_CC_MSVC) +# pragma section(".qtmimedatabase", read, shared) +__declspec(allocate(".qtmimedatabase")) __declspec(align(4096)) +# elif defined(Q_OS_DARWIN) +__attribute__((section("__TEXT,.qtmimedatabase"), aligned(4096))) +# elif (defined(Q_OF_ELF) || defined(Q_OS_WIN)) && defined(Q_CC_GNU) +__attribute__((section(".qtmimedatabase"), aligned(4096))) +# endif + +# include "qmimeprovider_database.cpp" + +# ifdef MIME_DATABASE_IS_ZSTD +# if !QT_CONFIG(zstd) +# error "MIME database is zstd but no support compiled in!" +# endif +# include +# endif +# ifdef MIME_DATABASE_IS_GZIP +# ifdef QT_NO_COMPRESS +# error "MIME database is zlib but no support compiled in!" +# endif +# define ZLIB_CONST +# include +# include +# endif #endif -} QT_BEGIN_NAMESPACE @@ -597,10 +620,55 @@ void QMimeBinaryProvider::loadGenericIcon(QMimeTypePrivate &data) //// +#if QT_CONFIG(mimetype_database) +static QString internalMimeFileName() +{ + return QStringLiteral(""); +} + +QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db, InternalDatabaseEnum) + : QMimeProviderBase(db, internalMimeFileName()) +{ + Q_STATIC_ASSERT_X(sizeof(mimetype_database), "Bundled MIME database is empty"); + Q_STATIC_ASSERT_X(sizeof(mimetype_database) <= MimeTypeDatabaseOriginalSize, + "Compressed MIME database is larger than the original size"); + Q_STATIC_ASSERT_X(MimeTypeDatabaseOriginalSize <= 16*1024*1024, + "Bundled MIME database is too big"); + const char *data = reinterpret_cast(mimetype_database); + qsizetype size = MimeTypeDatabaseOriginalSize; + +#ifdef MIME_DATABASE_IS_ZSTD + // uncompress with libzstd + std::unique_ptr uncompressed(new char[size]); + size = ZSTD_decompress(uncompressed.get(), size, mimetype_database, sizeof(mimetype_database)); + Q_ASSERT(!ZSTD_isError(size)); + data = uncompressed.get(); +#elif defined(MIME_DATABASE_IS_GZIP) + std::unique_ptr uncompressed(new char[size]); + z_stream zs = {}; + zs.next_in = mimetype_database; + zs.avail_in = sizeof(mimetype_database); + zs.next_out = reinterpret_cast(uncompressed.get()); + zs.avail_out = size; + + int res = inflateInit2(&zs, MAX_WBITS | 32); + Q_ASSERT(res == Z_OK); + res = inflate(&zs, Z_FINISH); + Q_ASSERT(res == Z_STREAM_END); + res = inflateEnd(&zs); + Q_ASSERT(res == Z_OK); + + data = uncompressed.get(); + size = zs.total_out; +#endif + + load(data, size); +} +#endif + QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db, const QString &directory) : QMimeProviderBase(db, directory) { - initResources(); ensureLoaded(); } @@ -692,6 +760,19 @@ bool QMimeXMLProvider::load(const QString &fileName, QString *errorMessage) return parser.parse(&file, fileName, errorMessage); } +#if QT_CONFIG(mimetype_database) +void QMimeXMLProvider::load(const char *data, qsizetype len) +{ + QBuffer buffer; + buffer.setData(QByteArray::fromRawData(data, len)); + buffer.open(QIODevice::ReadOnly); + QString errorMessage; + QMimeTypeParser parser(*this); + if (!parser.parse(&buffer, internalMimeFileName(), &errorMessage)) + qWarning("QMimeDatabase: Error loading internal MIME data\n%s", qPrintable(errorMessage)); +} +#endif + void QMimeXMLProvider::addGlobPattern(const QMimeGlobPattern &glob) { m_mimeTypeGlobs.addGlob(glob); diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h index b6268210c0..0629df8a95 100644 --- a/src/corelib/mimetypes/qmimeprovider_p.h +++ b/src/corelib/mimetypes/qmimeprovider_p.h @@ -132,6 +132,16 @@ private: class QMimeXMLProvider : public QMimeProviderBase { public: + enum InternalDatabaseEnum { InternalDatabase }; +#if QT_CONFIG(mimetype_database) + enum : bool { InternalDatabaseAvailable = true }; + QMimeXMLProvider(QMimeDatabasePrivate *db, InternalDatabaseEnum); +#else + enum : bool { InternalDatabaseAvailable = false }; + QMimeXMLProvider(QMimeDatabasePrivate *db, InternalDatabaseEnum) + : QMimeProviderBase(db, QString()) + { Q_UNREACHABLE() }; +#endif QMimeXMLProvider(QMimeDatabasePrivate *db, const QString &directory); ~QMimeXMLProvider(); @@ -156,6 +166,7 @@ public: private: void load(const QString &fileName); + void load(const char *data, qsizetype len); typedef QHash NameMimeTypeMap; NameMimeTypeMap m_nameMimeTypeMap; diff --git a/src/src.pro b/src/src.pro index 8ff3ec4c1f..592f0cf644 100644 --- a/src/src.pro +++ b/src/src.pro @@ -70,7 +70,7 @@ src_winmain.depends = sub-corelib # just for the module .pri file src_corelib.subdir = $$PWD/corelib src_corelib.target = sub-corelib -src_corelib.depends = src_tools_moc src_tools_rcc src_tools_tracegen +src_corelib.depends = src_tools_moc src_tools_tracegen src_xml.subdir = $$PWD/xml src_xml.target = sub-xml @@ -118,7 +118,7 @@ src_angle.target = sub-angle src_gui.subdir = $$PWD/gui src_gui.target = sub-gui -src_gui.depends = src_corelib +src_gui.depends = src_corelib src_tools_rcc src_platformheaders.subdir = $$PWD/platformheaders src_platformheaders.target = sub-platformheaders -- cgit v1.2.3 From 6bef90f3cfb886d74ac9ed38efeb8d80b7181011 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 26 Nov 2019 07:27:14 -0800 Subject: QTest::toString(QBitArray): fix Mismatched free() / delete / delete [] ==8015== Mismatched free() / delete / delete [] ==8015== at 0x483958B: operator delete[](void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==8015== by 0x48752D6: QTestResult::compare(bool, char const*, char*, char*, char const*, char const*, char const*, int) (qtestresult.cpp:356) ==8015== Address 0x602eb30 is 0 bytes inside a block of size 12 alloc'd ==8015== at 0x483777F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==8015== by 0x44AAE2: char* QTest::toString(QBitArray const&) (qtest.h:98) ==8015== by 0x44D212: bool QTest::qCompare(QBitArray const&, QBitArray const&, char const*, char const*, char const*, int) (qtestcase.h:352) Change-Id: Ia2aa807ffa8a4c798425fffd15dabfebfd63fdbd Reviewed-by: Giuseppe D'Angelo Reviewed-by: Edward Welbourne --- src/testlib/qtest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 27fe08e8f4..3b1ffb389e 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -95,7 +95,7 @@ template<> inline char *toString(const QByteArray &ba) template<> inline char *toString(const QBitArray &ba) { qsizetype size = ba.size(); - char *str = static_cast(malloc(size + 1)); + char *str = new char[size + 1]; for (qsizetype i = 0; i < size; ++i) str[i] = "01"[ba.testBit(i)]; str[size] = '\0'; -- cgit v1.2.3 From a77fdc9847bcf730862f262aac0a2c4e921f4411 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 8 Dec 2019 15:14:49 -0800 Subject: Doc: remove the claim that zero timers execute after GUI events This ties our hands on what we can do in our implementations. I don't care if you've depended on this in your code. It was wrong. Fixes: QTBUG-80600 Change-Id: I568dea4813b448fe9ba6fffd15de8865a27f0a35 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qtimer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 948f697dc5..4d8778ecf5 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -84,10 +84,10 @@ QT_BEGIN_NAMESPACE must start and stop the timer in its thread; it is not possible to start a timer from another thread. - As a special case, a QTimer with a timeout of 0 will time out as - soon as all the events in the window system's event queue have - been processed. This can be used to do heavy work while providing - a snappy user interface: + As a special case, a QTimer with a timeout of 0 will time out as soon as + possible, though the ordering between zero timers and other sources of + events is unspecified. Zero timers can be used to do some work while still + providing a snappy user interface: \snippet timers/timers.cpp 4 \snippet timers/timers.cpp 5 -- cgit v1.2.3 From 5a26bf9d65b75db3abefa967beb13b2510719bd5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 11 Dec 2019 09:30:26 +0100 Subject: Avoid initializing QFlags with 0 or nullptr in macOS-specific code It is being deprecated. Change-Id: If1b0b058140e197d41efae93025c4eefc2ed9bbd Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qfont.cpp | 2 +- src/plugins/platforms/cocoa/qcocoatheme.h | 2 +- src/widgets/kernel/qmacgesturerecognizer.cpp | 4 ++-- src/widgets/widgets/qmaccocoaviewcontainer_mac.mm | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index e162015aba..9ede90d8de 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2707,7 +2707,7 @@ bool QFontInfo::fixedPitch() const QChar ch[2] = { QLatin1Char('i'), QLatin1Char('m') }; QGlyphLayoutArray<2> g; int l = 2; - if (!engine->stringToCMap(ch, 2, &g, &l, 0)) + if (!engine->stringToCMap(ch, 2, &g, &l, {})) Q_UNREACHABLE(); Q_ASSERT(l == 2); engine->fontDef.fixedPitch = g.advances[0] == g.advances[1]; diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h index a00cbdfea3..50e56ef1bf 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.h +++ b/src/plugins/platforms/cocoa/qcocoatheme.h @@ -70,7 +70,7 @@ public: const QPalette *palette(Palette type = SystemPalette) const override; const QFont *font(Font type = SystemFont) const override; QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override; - QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions options = 0) const override; + QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions options = {}) const override; QVariant themeHint(ThemeHint hint) const override; QString standardButtonText(int button) const override; diff --git a/src/widgets/kernel/qmacgesturerecognizer.cpp b/src/widgets/kernel/qmacgesturerecognizer.cpp index d39b93e320..aac115a2cf 100644 --- a/src/widgets/kernel/qmacgesturerecognizer.cpp +++ b/src/widgets/kernel/qmacgesturerecognizer.cpp @@ -149,8 +149,8 @@ QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *e void QMacPinchGestureRecognizer::reset(QGesture *gesture) { QPinchGesture *g = static_cast(gesture); - g->setChangeFlags(0); - g->setTotalChangeFlags(0); + g->setChangeFlags({}); + g->setTotalChangeFlags({}); g->setScaleFactor(1.0f); g->setTotalScaleFactor(1.0f); g->setLastScaleFactor(1.0f); diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 88baf0410b..f261314c64 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -138,7 +138,7 @@ QMacCocoaViewContainerPrivate::~QMacCocoaViewContainerPrivate() */ QMacCocoaViewContainer::QMacCocoaViewContainer(NSView *view, QWidget *parent) - : QWidget(*new QMacCocoaViewContainerPrivate, parent, 0) + : QWidget(*new QMacCocoaViewContainerPrivate, parent, {}) { // Ensures that we have a QWindow, even if we're not a top level widget setAttribute(Qt::WA_NativeWindow); -- cgit v1.2.3 From a7108ec6cfb6411e40a4012f3e6d3b5d5fb9631d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 11 Dec 2019 10:51:22 +0100 Subject: Fix CVE-2019-19244 in SQLite Fixes: QTBUG-80635 Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd Reviewed-by: Jesus Fernandez --- .../0001-Fix-CVE-2019-19244-in-SQLite.patch | 26 ++++++++++++++++++++++ src/3rdparty/sqlite/sqlite3.c | 1 + 2 files changed, 27 insertions(+) create mode 100644 src/3rdparty/sqlite/patches/0001-Fix-CVE-2019-19244-in-SQLite.patch (limited to 'src') diff --git a/src/3rdparty/sqlite/patches/0001-Fix-CVE-2019-19244-in-SQLite.patch b/src/3rdparty/sqlite/patches/0001-Fix-CVE-2019-19244-in-SQLite.patch new file mode 100644 index 0000000000..9906292860 --- /dev/null +++ b/src/3rdparty/sqlite/patches/0001-Fix-CVE-2019-19244-in-SQLite.patch @@ -0,0 +1,26 @@ +From 676425e522e08eb0e7dfaacdac79a5de27542322 Mon Sep 17 00:00:00 2001 +From: Andy Shaw +Date: Wed, 11 Dec 2019 10:51:22 +0100 +Subject: [PATCH 53/53] Fix CVE-2019-19244 in SQLite + +Fixes: QTBUG-80635 +Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd +--- + src/3rdparty/sqlite/sqlite3.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c +index 8fd740b300..bd647ca1c2 100644 +--- a/src/3rdparty/sqlite/sqlite3.c ++++ b/src/3rdparty/sqlite/sqlite3.c +@@ -131679,6 +131679,7 @@ SQLITE_PRIVATE int sqlite3Select( + */ + if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct + && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0 ++ && p->pWin==0 + ){ + p->selFlags &= ~SF_Distinct; + pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0); +-- +2.21.0 (Apple Git-122.2) + diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 8fd740b300..bd647ca1c2 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -131679,6 +131679,7 @@ SQLITE_PRIVATE int sqlite3Select( */ if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct && sqlite3ExprListCompare(sSort.pOrderBy, pEList, -1)==0 + && p->pWin==0 ){ p->selFlags &= ~SF_Distinct; pGroupBy = p->pGroupBy = sqlite3ExprListDup(db, pEList, 0); -- cgit v1.2.3 From 3e9895f3de7f118beab3068b938ff6b9f2f5ef73 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 2 Dec 2019 18:54:14 +0100 Subject: Support checkable QComboBox items with styles using a popup dropdown The dropdown of a combobox is rendered using menu items when the style request it to do so via the SH_ComboBox_Popup style hint. In that case, checkable items were not supported; the QComboBox didn't pass the checked state correctly to the style, and the delegate used for rendering the items into the list view did not implement modifying the checked state of the item. However, the QStyleOptionMenuItem's checked state and checkType members were set anyway, as on e.g. macOS style we use a checkmark to show which item is currently selected in the combobox. The QStyle::State enum defines State_On and State_Off for toggleable things, so in addition to setting QStyleOptionMenuItem::checked, we are now also adding State_On or State_Off if the model provides a valid checked/unchecked state. Otherwise, we only set the checked state if the item is currently selected. In addition, we implement the delegate to support toggling of checkable model data with mouse and keyboard, using a simplified version of the QItemDelegate implementation. To avoid spurious item toggles when the popup is opened, we only handle mouse releases when the press was on the same row. In the fusion style, we ignore the workaround to let QtQuickControls render comboboxes if State_On or State_Off are set. [ChangeLog][QtWidgets][QComboBox] Support checkable items in styles that use a popup for the dropdown. Change-Id: Ia01519694b0419d777dc66b1ef683482fb01754c Fixes: QTBUG-60310 Reviewed-by: Mitch Curtis Reviewed-by: Christian Ehrlicher --- src/widgets/styles/qfusionstyle.cpp | 8 +++-- src/widgets/widgets/qcombobox.cpp | 59 ++++++++++++++++++++++++++++++++++++- src/widgets/widgets/qcombobox_p.h | 7 ++++- 3 files changed, 69 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 49b3703189..03d083bbf1 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1590,7 +1590,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool())) ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate - if (!ignoreCheckMark) { + if (!ignoreCheckMark || menuItem->state & (State_On | State_Off)) { // Check, using qreal and QRectF to avoid error accumulation const qreal boxMargin = dpiScaled(3.5, option); const qreal boxWidth = checkcol - 2 * boxMargin; @@ -1601,7 +1601,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio if (checkable) { if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) { // Radio button - if (checked || sunken) { + if (menuItem->state & State_On || checked || sunken) { painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::NoPen); @@ -1617,8 +1617,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio QStyleOptionButton box; box.QStyleOption::operator=(*option); box.rect = checkRect; - if (checked) + if (checked || menuItem->state & State_On) box.state |= State_On; + else + box.state |= State_Off; proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); } } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 19b442f477..4cfa5554e4 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -129,7 +129,15 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt if (option.state & QStyle::State_Selected) menuOption.state |= QStyle::State_Selected; menuOption.checkType = QStyleOptionMenuItem::NonExclusive; - menuOption.checked = mCombo->currentIndex() == index.row(); + // a valid checkstate means that the model has checkable items + const QVariant checkState = index.data(Qt::CheckStateRole); + if (!checkState.isValid()) { + menuOption.checked = mCombo->currentIndex() == index.row(); + } else { + menuOption.checked = qvariant_cast(checkState) == Qt::Checked; + menuOption.state |= qvariant_cast(checkState) == Qt::Checked + ? QStyle::State_On : QStyle::State_Off; + } if (QComboBoxDelegate::isSeparator(index)) menuOption.menuItemType = QStyleOptionMenuItem::Separator; else @@ -179,6 +187,55 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt return menuOption; } +bool QComboMenuDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, + const QStyleOptionViewItem &option, const QModelIndex &index) +{ + Q_ASSERT(event); + Q_ASSERT(model); + + // make sure that the item is checkable + Qt::ItemFlags flags = model->flags(index); + if (!(flags & Qt::ItemIsUserCheckable) || !(option.state & QStyle::State_Enabled) + || !(flags & Qt::ItemIsEnabled)) + return false; + + // make sure that we have a check state + const QVariant checkState = index.data(Qt::CheckStateRole); + if (!checkState.isValid()) + return false; + + // make sure that we have the right event type + if ((event->type() == QEvent::MouseButtonRelease) + || (event->type() == QEvent::MouseButtonDblClick) + || (event->type() == QEvent::MouseButtonPress)) { + QMouseEvent *me = static_cast(event); + if (me->button() != Qt::LeftButton) + return false; + + if ((event->type() == QEvent::MouseButtonPress) + || (event->type() == QEvent::MouseButtonDblClick)) { + pressedIndex = index.row(); + return false; + } + + if (index.row() != pressedIndex) + return false; + pressedIndex = -1; + + } else if (event->type() == QEvent::KeyPress) { + if (static_cast(event)->key() != Qt::Key_Space + && static_cast(event)->key() != Qt::Key_Select) + return false; + } else { + return false; + } + + // we don't support user-tristate items in QComboBox (not implemented in any style) + Qt::CheckState newState = (static_cast(checkState.toInt()) == Qt::Checked) + ? Qt::Unchecked : Qt::Checked; + return model->setData(index, newState, Qt::CheckStateRole); +} + #if QT_CONFIG(completer) void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index) { diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index c79406eafd..7a3fcf6e0f 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -266,7 +266,9 @@ class Q_AUTOTEST_EXPORT QComboMenuDelegate : public QAbstractItemDelegate { Q_OBJECT public: - QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {} + QComboMenuDelegate(QObject *parent, QComboBox *cmb) + : QAbstractItemDelegate(parent), mCombo(cmb), pressedIndex(-1) + {} protected: void paint(QPainter *painter, @@ -282,11 +284,14 @@ protected: return mCombo->style()->sizeFromContents( QStyle::CT_MenuItem, &opt, option.rect.size(), mCombo); } + bool editorEvent(QEvent *event, QAbstractItemModel *model, + const QStyleOptionViewItem &option, const QModelIndex &index) override; private: QStyleOptionMenuItem getStyleOption(const QStyleOptionViewItem &option, const QModelIndex &index) const; QComboBox *mCombo; + int pressedIndex; }; // ### Qt6: QStyledItemDelegate ? -- cgit v1.2.3 From b3c0e9afa0041d4d45e47880732deda1dd1013b9 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 9 Dec 2019 23:51:46 +0100 Subject: Deprecate qrand/qsrand They have been marked as deprecated in the documentation for a while Change-Id: Ia2b0b6dbd4c525e3e9c4bc835eee2c9da5a938cb Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e335916eac..861f087c60 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1266,8 +1266,10 @@ inline int qIntCast(float f) { return int(f); } /* Reentrant versions of basic rand() functions for random number generation */ -Q_CORE_EXPORT void qsrand(uint seed); -Q_CORE_EXPORT int qrand(); +#if QT_DEPRECATED_SINCE(5, 15) +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") void qsrand(uint seed); +Q_CORE_EXPORT QT_DEPRECATED_VERSION_X_5_15("use QRandomGenerator instead") int qrand(); +#endif #define QT_MODULE(x) -- cgit v1.2.3 From 07838840e86a5fb7f81520bb2a31d16f80e51e4c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 30 Nov 2019 15:06:20 +0100 Subject: Doc/SQL: update sql driver creation instructions Update the instructions on how to build and distribute the mysql and postgresql drivers on windows. Change-Id: Ie4d50c1c34820680d7496b9544eb00fcee17f8e7 Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/README | 4 +- src/sql/doc/snippets/code/doc_src_sql-driver.qdoc | 57 +++++++++++++++++++--- src/sql/doc/src/sql-driver.qdoc | 58 ++++++++++++++++------- 3 files changed, 95 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/plugins/sqldrivers/README b/src/plugins/sqldrivers/README index 7000fb5613..26418c5e36 100644 --- a/src/plugins/sqldrivers/README +++ b/src/plugins/sqldrivers/README @@ -1,5 +1,5 @@ -Please note that the DB2, Oracle and TDS client drivers are not distributed -with the Qt Open Source Editions. +Please note that the DB2, MySQL, Oracle and TDS client drivers are not +distributed with the Qt Open Source Editions. This is because the client libraries are distributed under a license which is not compatible with the GPL license. diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc index 9709deeccb..12a39d80b2 100644 --- a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc +++ b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc @@ -70,7 +70,6 @@ BEGIN END //! [1] - //! [3] cd $QTDIR/qtbase/src/plugins/sqldrivers qmake -- MYSQL_PREFIX=/usr/local @@ -86,14 +85,15 @@ make install //! [5] cd %QTDIR%\qtbase\src\plugins\sqldrivers -qmake -- MYSQL_INCDIR=C:/MySQL/include "MYSQL_LIBDIR=C:/MYSQL/MySQL Server /lib/opt" +qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib" nmake sub-mysql +nmake install //! [5] //! [6] cd $QTDIR/qtbase/src/plugins/sqldrivers -qmake -- "OCI_INCDIR=$ORACLE_HOME/rdbms/public" OCI_LIBDIR=$ORACLE_HOME/lib "OCI_LIBS=-lclntsh -lwtc9" +qmake -- OCI_INCDIR="$ORACLE_HOME/rdbms/public" OCI_LIBDIR="$ORACLE_HOME/lib" OCI_LIBS="-lclntsh -lwtc9" make sub-oci //! [6] @@ -142,6 +142,7 @@ make sub-psql cd %QTDIR%\qtbase\src\plugins\sqldrivers qmake -- PSQL_INCDIR=C:/psql/include PSQL_LIBDIR=C:/psql/lib/ms nmake sub-psql +nmake install //! [15] @@ -156,6 +157,7 @@ make sub-tds cd %QTDIR%\qtbase\src\plugins\sqldrivers qmake nmake sub-tds +nmake install //! [17] @@ -168,8 +170,9 @@ make sub-db2 //! [20] cd %QTDIR%\qtbase\src\plugins\sqldrivers -qmake -- "DB2_PREFIX=/sqllib" +qmake -- DB2_PREFIX="/sqllib" nmake sub-db2 +nmake install //! [20] @@ -184,6 +187,7 @@ make sub-sqlite cd %QTDIR%\qtbase\src\plugins\sqldrivers qmake -- -system-sqlite SQLITE3_PREFIX=C:/SQLITE nmake sub-sqlite +nmake install //! [23] @@ -205,6 +209,7 @@ make sub-ibase cd %QTDIR%\qtbase\src\plugins\sqldrivers qmake -- IBASE_INCDIR=C:/interbase/include nmake sub-ibase +nmake install //! [29] @@ -212,17 +217,18 @@ nmake sub-ibase cd %QTDIR%\qtbase\src\plugins\sqldrivers qmake -- IBASE_INCDIR=C:/interbase/include IBASE_LIBS=-lfbclient nmake sub-ibase +nmake install //! [30] //! [32] -configure OCI_INCDIR=/usr/include/oracle/10.1.0.3/client OCI_LIBDIR=/usr/lib/oracle/10.1.0.3/client/lib -R /usr/lib/oracle/10.1.0.3/client/lib "OCI_LIBS=-lclntsh -lnnz10" +configure OCI_INCDIR=/usr/include/oracle/10.1.0.3/client OCI_LIBDIR=/usr/lib/oracle/10.1.0.3/client/lib -R /usr/lib/oracle/10.1.0.3/client/lib OCI_LIBS="-lclntsh -lnnz10" make //! [32] //! [33] cd $QTDIR/qtbase/src/plugins/sqldrivers -qmake -- OCI_INCDIR=/usr/include/oracle/10.1.0.3/client OCI_LIBDIR=/usr/lib/oracle/10.1.0.3/client/lib "OCI_LIBS=-Wl,-rpath,/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10" +qmake -- OCI_INCDIR=/usr/include/oracle/10.1.0.3/client OCI_LIBDIR=/usr/lib/oracle/10.1.0.3/client/lib OCI_LIBS="-Wl,-rpath,/usr/lib/oracle/10.1.0.3/client/lib -lclntsh -lnnz10" make sub-oci //! [33] @@ -250,3 +256,42 @@ q.exec(QString("CREATE TABLE %1 (id INTEGER)").arg(tableString)); // Call toLower() on the string so that it can be matched QSqlRecord rec = database.record(tableString.toLower()); //! [40] + +//! [41] +C:\Qt5\5.13.2\Src\qtbase\src\plugins\sqldrivers>qmake -version +QMake version 3.1 +Using Qt version 5.13.2 in C:/Qt5/5.13.2/mingw73_64/lib +C:\Qt5\5.13.2\Src\qtbase\src\plugins\sqldrivers>qmake -- MYSQL_INCDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/include" MYSQL_LIBDIR="C:/Program Files/MySQL/MySQL Connector C 6.1/lib" +Info: creating stash file C:\Qt5\5.13.2\Src\qtbase\src\plugins\sqldrivers\.qmake.stash + +Running configuration tests... +Checking for DB2 (IBM)... no +Checking for InterBase... no +Checking for MySQL... yes +Checking for OCI (Oracle)... no +Checking for ODBC... yes +Checking for PostgreSQL... no +Checking for SQLite (version 2)... no +Checking for TDS (Sybase)... no +Done running configuration tests. + +Configure summary: + +Qt Sql Drivers: + DB2 (IBM) .............................. no + InterBase .............................. no + MySql .................................. yes + OCI (Oracle) ........................... no + ODBC ................................... yes + PostgreSQL ............................. no + SQLite2 ................................ no + SQLite ................................. yes + Using system provided SQLite ......... no + TDS (Sybase) ........................... no + +Qt is now configured for building. Just run 'mingw32-make'. +Once everything is built, you must run 'mingw32-make install'. +Qt will be installed into 'C:\Qt5\5.13.2\mingw73_64'. + +Prior to reconfiguration, make sure you remove any leftovers from the previous build. +//! [41] diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index c6ac4d17ff..9c26c4089c 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -48,7 +48,7 @@ \header \li Driver name \li DBMS \row \li \l{#QDB2}{QDB2} \li IBM DB2 (version 7.1 and above) \row \li \l{#QIBASE}{QIBASE} \li Borland InterBase - \row \li \l{#QMYSQL}{QMYSQL} \li MySQL + \row \li \l{#QMYSQL}{QMYSQL} \li MySQL (version 5.0 and above) \row \li \l{#QOCI}{QOCI} \li Oracle Call Interface Driver \row \li \l{#QODBC}{QODBC} \li Open Database Connectivity (ODBC) - Microsoft SQL Server and other @@ -70,7 +70,8 @@ access to the API exposed by the DBMS, and is typically shipped with it. Most installation programs also allow you to install "development libraries", and these are what you need. These libraries are responsible - for the low-level communication with the DBMS. + for the low-level communication with the DBMS. Also make sure to install + the correct database libraries for your Qt architecture (32 or 64 bit). \note When using Qt under Open Source terms but with a proprietary database, verify the client library's license compatibility with @@ -91,11 +92,21 @@ may be necessary to specify these paths using the \c *_INCDIR=, \c *_LIBDIR=, or \c *_PREFIX= command-line options. For example, if your MySQL files are installed in \c /usr/local/mysql (or in - \c{C:\mysql} on Windows), then pass the following parameter to - configure: \c MYSQL_PREFIX=/usr/local/mysql - (or \c{MYSQL_PREFIX=C:\mysql} for Windows). + \c{C:/Program Files/MySQL/MySQL Connector C 6.1} on Windows), then pass the + following parameter to configure: \c MYSQL_PREFIX=/usr/local/mysql + (or \c{MYSQL_PREFIX="C:/Program Files/MySQL/MySQL Connector C 6.1"} for Windows). The particulars for each driver are explained below. + If something goes wrong and you want qmake to recheck your + available drivers, you must remove \e{config.cache} in + \e{/qtbase/src/plugins/sqldrivers} - otherwise qmake will not + search for the available drivers again. If you encounter an error during + the qmake stage, open \e{config.log} to see what went wrong. + + A typical qmake run (in this case to configure for MySQL) looks like this: + + \snippet code/doc_src_sql-driver.qdoc 41 + Due to the practicalities of dealing with external dependencies, only the SQLite3 plugin is shipped with binary builds of Qt. To be able to add additional drivers to the Qt installation @@ -112,11 +123,11 @@ \section1 Driver Specifics \target QMYSQL - \section2 QMYSQL for MySQL 4 and higher + \section2 QMYSQL for MySQL 5 and higher \section3 QMYSQL Stored Procedure Support - MySQL 5 introduces stored procedure support at the SQL level, but no + MySQL 5 has stored procedure support at the SQL level, but no API to control IN, OUT, and INOUT parameters. Therefore, parameters have to be set and read using SQL commands instead of QSqlQuery::bindValue(). @@ -159,16 +170,32 @@ \section3 How to Build the QMYSQL Plugin on Windows - You need to get the MySQL installation files. Run \c SETUP.EXE and - choose "Custom Install". Install the "Libs & Include Files" Module. - Build the plugin as follows (here it is assumed that MySQL is - installed in \c{C:\MySQL}): + You need to get the MySQL installation files (e.g. + \e{mysql-installer-web-community-8.0.18.0.msi}). Run the installer, + select custom installation and install the MySQL C Connector + which matches your Qt installation (x86 or x64). + After installation make sure that the needed files are there: + \list + \li \c {/lib/libmysql.lib} + \li \c {/lib/libmysql.dll} + \li \c {/include/mysql.h} + \endlist + + Build the plugin as follows (here it is assumed that the MySQL + C Connector is installed in + \c{C:/Program Files/MySQL/MySQL Connector C 6.1}): \snippet code/doc_src_sql-driver.qdoc 5 If you are not using a Microsoft compiler, replace \c nmake with \c mingw32-make in the line above. + When you distribute your application, remember to include libmysql.dll + in your installation package. It must be placed in the same folder + as the application executable. libmysql.dll additionally needs the + MSVC runtime libraries which can be installed with vcredist.exe + (\l {https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads}(vcredist.exe) + \target QOCI \section2 QOCI for the Oracle Call Interface (OCI) @@ -398,11 +425,6 @@ \snippet code/doc_src_sql-driver.qdoc 40 - \section3 QPSQL BLOB Support - - Binary Large Objects are supported through the \c BYTEA field type in - PostgreSQL server versions >= 7.1. - \section3 QPSQL Forward-only query support To use forward-only queries, you must build the QPSQL plugin with @@ -463,6 +485,10 @@ Users of MinGW may wish to consult the following online document: \l{http://www.postgresql.org/docs/current/static/installation-platform-notes.html#INSTALLATION-NOTES-MINGW}{PostgreSQL MinGW/Native Windows}. + When you distribute your application, remember to include libpq.dll + in your installation package. It must be placed in the same folder + as the application executable. + \target QTDS \section2 QTDS for Sybase Adaptive Server -- cgit v1.2.3 From c15d6a155c6121bad68a3ec60be62181fb92d0f8 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 10 Dec 2019 14:55:14 +0100 Subject: QVariant: introduce ShouldDeleteVariantData flag This flag is used in QSequentialIterable and QAssociativeIterable to indicate that the data pointer in VariantData should be deleted after the variant has been constructed. The use case for this is https://codereview.qt-project.org/c/qt/qtdeclarative/+/284151, where we have a proxy iterator and cannot easily return a pointer to already owned data, as it is hard to manage its lifetime in the iterator. In contrast, it is clear that we can release the memory in the QSequentialIterable functions, as it has already been copied into the QVariant there. Change-Id: I2b33497d991cd4f752153e0ebda767b82e4bb851 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qvariant.cpp | 35 ++++++++++++++++------------------- src/corelib/kernel/qvariant_p.h | 5 +++++ 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 84ad555f34..a1e1c71d12 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -4520,15 +4520,24 @@ QSequentialIterable::const_iterator QSequentialIterable::end() const return it; } +static const QVariant variantFromVariantDataHelper(const QtMetaTypePrivate::VariantData &d) { + QVariant v; + if (d.metaTypeId == qMetaTypeId()) + v = *reinterpret_cast(d.data); + else + v = QVariant(d.metaTypeId, d.data, d.flags & ~QVariantConstructionFlags::ShouldDeleteVariantData); + if (d.flags & QVariantConstructionFlags::ShouldDeleteVariantData) + QMetaType::destroy(d.metaTypeId, const_cast(d.data)); + return v; +} + /*! Returns the element at position \a idx in the container. */ QVariant QSequentialIterable::at(int idx) const { const QtMetaTypePrivate::VariantData d = m_impl.at(idx); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return QVariant(d.metaTypeId, d.data, d.flags); + return variantFromVariantDataHelper(d); } /*! @@ -4605,9 +4614,7 @@ QSequentialIterable::const_iterator::operator=(const const_iterator &other) const QVariant QSequentialIterable::const_iterator::operator*() const { const QtMetaTypePrivate::VariantData d = m_impl.getCurrent(); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return QVariant(d.metaTypeId, d.data, d.flags); + return variantFromVariantDataHelper(d); } /*! @@ -4939,10 +4946,7 @@ QAssociativeIterable::const_iterator::operator=(const const_iterator &other) const QVariant QAssociativeIterable::const_iterator::operator*() const { const QtMetaTypePrivate::VariantData d = m_impl.getCurrentValue(); - QVariant v(d.metaTypeId, d.data, d.flags); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return v; + return variantFromVariantDataHelper(d); } /*! @@ -4951,10 +4955,7 @@ const QVariant QAssociativeIterable::const_iterator::operator*() const const QVariant QAssociativeIterable::const_iterator::key() const { const QtMetaTypePrivate::VariantData d = m_impl.getCurrentKey(); - QVariant v(d.metaTypeId, d.data, d.flags); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return v; + return variantFromVariantDataHelper(d); } /*! @@ -4962,11 +4963,7 @@ const QVariant QAssociativeIterable::const_iterator::key() const */ const QVariant QAssociativeIterable::const_iterator::value() const { - const QtMetaTypePrivate::VariantData d = m_impl.getCurrentValue(); - QVariant v(d.metaTypeId, d.data, d.flags); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return v; + return operator*(); } /*! diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 3d87beac83..b8b63b5e6f 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -105,6 +105,11 @@ inline T *v_cast(QVariant::Private *d, T * = nullptr) #endif +enum QVariantConstructionFlags : uint { + Default = 0x0, + PointerType = 0x1, + ShouldDeleteVariantData = 0x2 // only used in Q*Iterable +}; //a simple template that avoids to allocate 2 memory chunks when creating a QVariant template class QVariantPrivateSharedEx : public QVariant::PrivateShared -- cgit v1.2.3 From 3162345670ffe67a71a62abaeda0d8eb8ad0682e Mon Sep 17 00:00:00 2001 From: Michael Dippold Date: Wed, 4 Dec 2019 14:48:00 -0800 Subject: Support both qrc and qml files for qmlimportscanner Some projects can be configured to have both qrcFiles and qml-root-path included in the deployment settings file. The addition to qrc scanning prevented the qml root directory from being scanned. Change-Id: Idadb62f5572be45d0083294440bdb29740c2c47e Reviewed-by: Andy Shaw --- src/tools/androiddeployqt/main.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index 550ed0832f..6fd32c2d29 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1717,17 +1717,18 @@ bool scanImports(Options *options, QSet *usedDependencies) qmlImportScanner += QLatin1String(" -qrcFiles"); for (const QString &qrcFile : options->qrcFiles) qmlImportScanner += QLatin1Char(' ') + shellQuote(qrcFile); - } else { - if (rootPath.isEmpty()) - rootPath = QFileInfo(options->inputFileName).absolutePath(); - else - rootPath = QFileInfo(rootPath).absoluteFilePath(); - - if (!rootPath.endsWith(QLatin1Char('/'))) - rootPath += QLatin1Char('/'); - qmlImportScanner += QLatin1String(" -rootPath %1").arg(shellQuote(rootPath)); } + if (rootPath.isEmpty()) + rootPath = QFileInfo(options->inputFileName).absolutePath(); + else + rootPath = QFileInfo(rootPath).absoluteFilePath(); + + if (!rootPath.endsWith(QLatin1Char('/'))) + rootPath += QLatin1Char('/'); + + qmlImportScanner += QLatin1String(" -rootPath %1").arg(shellQuote(rootPath)); + QStringList importPaths; importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml")); if (!rootPath.isEmpty()) -- cgit v1.2.3 From b89f2ebd9543d4cf60821a9c3cc12547d7d2253e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 22 Nov 2019 23:19:34 +0100 Subject: QWaitCondition: un-deprecate wait() functions with ulong arg The wait() functions with the unsigned long arg were marked for removal for Qt6 but due to the high usage of this functions and the very small gain, revert the deprecation. Change-Id: I9c9b720d279a59d87730f51de0f321b3794aa88e Reviewed-by: Paul Wicking Reviewed-by: Thiago Macieira --- src/corelib/thread/qwaitcondition.h | 9 ++------- src/corelib/thread/qwaitcondition.qdoc | 6 ++---- src/corelib/thread/qwaitcondition_unix.cpp | 4 ---- 3 files changed, 4 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/corelib/thread/qwaitcondition.h b/src/corelib/thread/qwaitcondition.h index 079049af25..0a47ac3717 100644 --- a/src/corelib/thread/qwaitcondition.h +++ b/src/corelib/thread/qwaitcondition.h @@ -58,14 +58,11 @@ public: bool wait(QMutex *lockedMutex, QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); + bool wait(QMutex *lockedMutex, unsigned long time); + bool wait(QReadWriteLock *lockedReadWriteLock, QDeadlineTimer deadline = QDeadlineTimer(QDeadlineTimer::Forever)); -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_VERSION_X_5_15("Use wait(QMutex *lockedMutex, QDeadlineTimer deadline) instead") - bool wait(QMutex *lockedMutex, unsigned long time); - QT_DEPRECATED_VERSION_X_5_15("Use wait(QReadWriteLock *lockedReadWriteLock, QDeadlineTimer deadline) instead") bool wait(QReadWriteLock *lockedReadWriteLock, unsigned long time); -#endif void wakeOne(); void wakeAll(); @@ -94,10 +91,8 @@ public: { return true; } bool wait(QReadWriteLock *, QDeadlineTimer = QDeadlineTimer(QDeadlineTimer::Forever)) { return true; } -#if QT_DEPRECATED_SINCE(5, 15) bool wait(QMutex *, unsigned long) { return true; } bool wait(QReadWriteLock *, unsigned long) { return true; } -#endif void wakeOne() {} void wakeAll() {} diff --git a/src/corelib/thread/qwaitcondition.qdoc b/src/corelib/thread/qwaitcondition.qdoc index 9da6f6f25c..014d549477 100644 --- a/src/corelib/thread/qwaitcondition.qdoc +++ b/src/corelib/thread/qwaitcondition.qdoc @@ -119,16 +119,14 @@ \sa wakeOne() */ -#if QT_DEPRECATED_SINCE(5, 15) /*! \fn bool QWaitCondition::wait(QMutex *lockedMutex, unsigned long time) - \obsolete use wait(QMutex *lockedMutex, QDeadlineTimer deadline) instead + \overload */ /*! \fn bool QWaitCondition::wait(QReadWriteLock *lockedReadWriteLock, unsigned long time) - \obsolete use wait(QReadWriteLock *lockedReadWriteLock, QDeadlineTimer deadline) instead + \overload */ -#endif /*! \fn bool QWaitCondition::wait(QMutex *lockedMutex, QDeadlineTimer deadline) diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp index 80f9e780e7..88b058f410 100644 --- a/src/corelib/thread/qwaitcondition_unix.cpp +++ b/src/corelib/thread/qwaitcondition_unix.cpp @@ -202,14 +202,12 @@ void QWaitCondition::wakeAll() report_error(pthread_mutex_unlock(&d->mutex), "QWaitCondition::wakeAll()", "mutex unlock"); } -#if QT_DEPRECATED_SINCE(5, 15) bool QWaitCondition::wait(QMutex *mutex, unsigned long time) { if (time == std::numeric_limits::max()) return wait(mutex, QDeadlineTimer(QDeadlineTimer::Forever)); return wait(mutex, QDeadlineTimer(time)); } -#endif bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline) { @@ -231,14 +229,12 @@ bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline) return returnValue; } -#if QT_DEPRECATED_SINCE(5, 15) bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time) { if (time == std::numeric_limits::max()) return wait(readWriteLock, QDeadlineTimer(QDeadlineTimer::Forever)); return wait(readWriteLock, QDeadlineTimer(time)); } -#endif bool QWaitCondition::wait(QReadWriteLock *readWriteLock, QDeadlineTimer deadline) { -- cgit v1.2.3 From 5a660353edde7b9f382ee41ecf278fc4537f38fa Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Wed, 13 Nov 2019 10:20:09 +0100 Subject: Doc: Fix qdoc compilation errors qtbase Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking --- src/corelib/doc/src/qtcore-index.qdoc | 2 +- src/corelib/doc/src/resource-system.qdoc | 4 +- src/corelib/global/qendian.cpp | 6 +- src/corelib/io/qresource.cpp | 4 +- src/corelib/thread/qatomic.cpp | 204 ++++++++++++++++--------- src/corelib/thread/qatomic.h | 6 + src/gui/doc/src/qtgui.qdoc | 2 +- src/gui/kernel/qwindow.cpp | 2 +- src/network/ssl/qsslsocket.cpp | 2 +- src/testlib/doc/src/qttest-best-practices.qdoc | 4 +- src/widgets/styles/qstyleoption.cpp | 2 +- 11 files changed, 156 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/src/qtcore-index.qdoc b/src/corelib/doc/src/qtcore-index.qdoc index 40a6584af0..29fc25f69d 100644 --- a/src/corelib/doc/src/qtcore-index.qdoc +++ b/src/corelib/doc/src/qtcore-index.qdoc @@ -56,7 +56,7 @@ \include module-use.qdocinc using qt module \quotefile overview/using-qt-core.cmake - See also the \l[QtDoc]{Building with CMake} overview. + See also the \l[QtDoc]{Build with CMake} overview. \section2 Building with qmake diff --git a/src/corelib/doc/src/resource-system.qdoc b/src/corelib/doc/src/resource-system.qdoc index 69ec5e556b..f9ef317799 100644 --- a/src/corelib/doc/src/resource-system.qdoc +++ b/src/corelib/doc/src/resource-system.qdoc @@ -189,13 +189,13 @@ XML file to indicate a file should be most compressed, regardless of which algorithms \c rcc supports. - \li \c{zstd}: use the \l{Zstandard}{https://zstd.net} library to compress + \li \c{zstd}: use the \l{https://zstd.net}{Zstandard} library to compress contents. Valid compression levels range from 1 to 19, 1 is least compression (least CPU time) and 19 is the most compression (most CPU time). The default level is 14. A special value of 0 tells the \c{zstd} library to choose an implementation-defined default. - \li \c{zlib}: use the \l{zlib}{https://zlib.net} library to compress + \li \c{zlib}: use the \l{https://zlib.net}{zlib} library to compress contents. Valid compression levels range from 1 to 9, with 1the least compression (least CPU time) and 9 the most compression (most CPU time). The special value 0 means "no compression" and should not be used. The diff --git a/src/corelib/global/qendian.cpp b/src/corelib/global/qendian.cpp index 7fd6e13d3b..98dc6a9a4b 100644 --- a/src/corelib/global/qendian.cpp +++ b/src/corelib/global/qendian.cpp @@ -137,7 +137,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(const void *src) + \fn template inline T qFromLittleEndian(const void *src) \since 4.3 \relates @@ -159,7 +159,7 @@ QT_BEGIN_NAMESPACE \sa qToLittleEndian() */ /*! - \fn template T qFromLittleEndian(T src) + \fn template inline T qFromLittleEndian(T src) \since 4.3 \relates \overload @@ -171,7 +171,7 @@ QT_BEGIN_NAMESPACE unmodified. */ /*! - \fn template T qFromLittleEndian(const void *src, qsizetype count, void *dest) + \fn template inline T qFromLittleEndian(const void *src, qsizetype count, void *dest) \since 5.12 \relates diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 22c22ce711..5cbe49e2f7 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -280,9 +280,9 @@ static inline QStringList *resourceSearchPaths() RCC tool used to compress the payload. \value NoCompression Contents are not compressed - \value ZlibCompression Contents are compressed using \l{zlib}{https://zlib.net} and can + \value ZlibCompression Contents are compressed using \l{https://zlib.net}{zlib} and can be decompressed using the qUncompress() function. - \value ZstdCompression Contents are compressed using \l{zstd}{https://zstd.net}. To + \value ZstdCompression Contents are compressed using \l{https://zstd.net}{zstd}. To decompress, use the \c{ZSTD_decompress} function from the zstd library. diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index b1a7edad91..5c3ad9412f 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -234,22 +234,26 @@ \sa QAtomicPointer */ -/*! \fn QAtomicInt::QAtomicInt(int value) +/*! + \fn QAtomicInt::QAtomicInt(int value) Constructs a QAtomicInt with the given \a value. */ -/*! \fn QAtomicInteger::QAtomicInteger(T value) +/*! + \fn template QAtomicInteger::QAtomicInteger(T value) Constructs a QAtomicInteger with the given \a value. */ -/*! \fn template QAtomicInteger::QAtomicInteger(const QAtomicInteger &other) +/*! + \fn template QAtomicInteger::QAtomicInteger(const QAtomicInteger &other) Constructs a copy of \a other. */ -/*! \fn template QAtomicInteger &QAtomicInteger::operator=(const QAtomicInteger &other) +/*! + \fn template QAtomicInteger &QAtomicInteger::operator=(const QAtomicInteger &other) Assigns \a other to this QAtomicInteger and returns a reference to this QAtomicInteger. @@ -344,19 +348,22 @@ \sa storeRelaxed(), storeRelease() */ -/*! \fn template bool QAtomicInteger::isReferenceCountingNative() +/*! + \fn template bool QAtomicInteger::isReferenceCountingNative() Returns \c true if reference counting is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isReferenceCountingWaitFree() +/*! + \fn template bool QAtomicInteger::isReferenceCountingWaitFree() Returns \c true if atomic reference counting is wait-free, false otherwise. */ -/*! \fn template bool QAtomicInteger::ref() +/*! + \fn template bool QAtomicInteger::ref() Atomically increments the value of this QAtomicInteger. Returns \c true if the new value is non-zero, false otherwise. @@ -394,7 +401,8 @@ \sa ref(), operator++(), operator--(int) */ -/*! \fn template bool QAtomicInteger::deref() +/*! + \fn template bool QAtomicInteger::deref() Atomically decrements the value of this QAtomicInteger. Returns \c true if the new value is non-zero, false otherwise. @@ -432,18 +440,21 @@ \sa deref(), operator--(), operator++(int) */ -/*! \fn template bool QAtomicInteger::isTestAndSetNative() +/*! + \fn template bool QAtomicInteger::isTestAndSetNative() Returns \c true if test-and-set is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isTestAndSetWaitFree() +/*! + \fn template bool QAtomicInteger::isTestAndSetWaitFree() Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn template bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) Atomic test-and-set. @@ -457,7 +468,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) Atomic test-and-set. @@ -472,7 +484,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) Atomic test-and-set. @@ -487,7 +500,8 @@ re-ordered after the atomic operation. */ -/*! \fn template bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) +/*! + \fn template bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) Atomic test-and-set. @@ -502,19 +516,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicInteger::isFetchAndStoreNative() +/*! + \fn template bool QAtomicInteger::isFetchAndStoreNative() Returns \c true if fetch-and-store is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isFetchAndStoreWaitFree() +/*! + \fn template bool QAtomicInteger::isFetchAndStoreWaitFree() Returns \c true if atomic fetch-and-store is wait-free, false otherwise. */ -/*! \fn template T QAtomicInteger::fetchAndStoreRelaxed(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreRelaxed(T newValue) Atomic fetch-and-store. @@ -526,7 +543,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T QAtomicInteger::fetchAndStoreAcquire(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreAcquire(T newValue) Atomic fetch-and-store. @@ -539,7 +557,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T QAtomicInteger::fetchAndStoreRelease(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreRelease(T newValue) Atomic fetch-and-store. @@ -552,7 +571,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T QAtomicInteger::fetchAndStoreOrdered(T newValue) +/*! + \fn template T QAtomicInteger::fetchAndStoreOrdered(T newValue) Atomic fetch-and-store. @@ -565,19 +585,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicInteger::isFetchAndAddNative() +/*! + \fn template bool QAtomicInteger::isFetchAndAddNative() Returns \c true if fetch-and-add is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicInteger::isFetchAndAddWaitFree() +/*! + \fn template bool QAtomicInteger::isFetchAndAddWaitFree() Returns \c true if atomic fetch-and-add is wait-free, false otherwise. */ -/*! \fn template T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) Atomic fetch-and-add. @@ -591,7 +614,8 @@ \sa operator+=(), fetchAndSubRelaxed() */ -/*! \fn template T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) Atomic fetch-and-add. @@ -606,7 +630,8 @@ \sa operator+=(), fetchAndSubAcquire() */ -/*! \fn template T QAtomicInteger::fetchAndAddRelease(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddRelease(T valueToAdd) Atomic fetch-and-add. @@ -621,7 +646,8 @@ \sa operator+=(), fetchAndSubRelease() */ -/*! \fn template T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) +/*! + \fn template T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) Atomic fetch-and-add. @@ -636,7 +662,8 @@ \sa operator+=(), fetchAndSubOrdered() */ -/*! \fn template T QAtomicInteger::operator+=(T value) +/*! + \fn template T QAtomicInteger::operator+=(T value) \since 5.3 Atomic add-and-fetch. @@ -650,7 +677,8 @@ \sa fetchAndAddOrdered(), operator-=() */ -/*! \fn template T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -665,7 +693,8 @@ \sa operator-=(), fetchAndAddRelaxed() */ -/*! \fn template T QAtomicInteger::fetchAndSubAcquire(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubAcquire(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -681,7 +710,8 @@ \sa operator-=(), fetchAndAddAcquire() */ -/*! \fn template T QAtomicInteger::fetchAndSubRelease(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubRelease(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -697,7 +727,8 @@ \sa operator-=(), fetchAndAddRelease() */ -/*! \fn template T QAtomicInteger::fetchAndSubOrdered(T valueToSub) +/*! + \fn template T QAtomicInteger::fetchAndSubOrdered(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -713,7 +744,8 @@ \sa operator-=(), fetchAndAddOrdered() */ -/*! \fn template T QAtomicInteger::operator-=(T value) +/*! + \fn template T QAtomicInteger::operator-=(T value) \since 5.3 Atomic sub-and-fetch. @@ -727,7 +759,8 @@ \sa fetchAndSubOrdered(), operator+=() */ -/*! \fn template T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -742,7 +775,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrAcquire(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrAcquire(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -758,7 +792,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrRelease(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrRelease(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -774,7 +809,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::fetchAndOrOrdered(T valueToOr) +/*! + \fn template T QAtomicInteger::fetchAndOrOrdered(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -790,7 +826,8 @@ \sa operator|=() */ -/*! \fn template T QAtomicInteger::operator|=(T value) +/*! + \fn template T QAtomicInteger::operator|=(T value) \since 5.3 Atomic or-and-fetch. @@ -804,7 +841,8 @@ \sa fetchAndOrOrdered() */ -/*! \fn template T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -819,7 +857,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorAcquire(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorAcquire(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -835,7 +874,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorRelease(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorRelease(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -851,7 +891,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::fetchAndXorOrdered(T valueToXor) +/*! + \fn template T QAtomicInteger::fetchAndXorOrdered(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -867,7 +908,8 @@ \sa operator^=() */ -/*! \fn template T QAtomicInteger::operator^=(T value) +/*! + \fn template T QAtomicInteger::operator^=(T value) \since 5.3 Atomic xor-and-fetch. @@ -881,7 +923,8 @@ \sa fetchAndXorOrdered() */ -/*! \fn template T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -896,7 +939,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -912,7 +956,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndRelease(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndRelease(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -928,7 +973,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) +/*! + \fn template T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -944,7 +990,8 @@ \sa operator&=() */ -/*! \fn template T QAtomicInteger::operator&=(T value) +/*! + \fn template T QAtomicInteger::operator&=(T value) \since 5.3 Atomic add-and-fetch. @@ -1287,17 +1334,20 @@ \sa QAtomicInteger */ -/*! \fn template QAtomicPointer::QAtomicPointer(T *value) +/*! + \fn template QAtomicPointer::QAtomicPointer(T *value) Constructs a QAtomicPointer with the given \a value. */ -/*! \fn template QAtomicPointer::QAtomicPointer(const QAtomicPointer &other) +/*! + \fn template QAtomicPointer::QAtomicPointer(const QAtomicPointer &other) Constructs a copy of \a other. */ -/*! \fn template QAtomicPointer &QAtomicPointer::operator=(const QAtomicPointer &other) +/*! + \fn template QAtomicPointer &QAtomicPointer::operator=(const QAtomicPointer &other) Assigns \a other to this QAtomicPointer and returns a reference to this QAtomicPointer. @@ -1369,18 +1419,21 @@ \sa storeRelaxed(), loadRelaxed() */ -/*! \fn template bool QAtomicPointer::isTestAndSetNative() +/*! + \fn template bool QAtomicPointer::isTestAndSetNative() Returns \c true if test-and-set is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isTestAndSetWaitFree() +/*! + \fn template bool QAtomicPointer::isTestAndSetWaitFree() Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn template bool QAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1394,7 +1447,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template bool QAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1409,7 +1463,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template bool QAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1424,7 +1479,8 @@ re-ordered after the atomic operation. */ -/*! \fn template bool QAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) +/*! + \fn template bool QAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) Atomic test-and-set. @@ -1439,19 +1495,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicPointer::isFetchAndStoreNative() +/*! + \fn template bool QAtomicPointer::isFetchAndStoreNative() Returns \c true if fetch-and-store is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isFetchAndStoreWaitFree() +/*! + \fn template bool QAtomicPointer::isFetchAndStoreWaitFree() Returns \c true if atomic fetch-and-store is wait-free, false otherwise. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreRelaxed(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreRelaxed(T *newValue) Atomic fetch-and-store. @@ -1463,7 +1522,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreAcquire(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreAcquire(T *newValue) Atomic fetch-and-store. @@ -1476,7 +1536,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreRelease(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreRelease(T *newValue) Atomic fetch-and-store. @@ -1489,7 +1550,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndStoreOrdered(T *newValue) +/*! + \fn template T *QAtomicPointer::fetchAndStoreOrdered(T *newValue) Atomic fetch-and-store. @@ -1502,19 +1564,22 @@ may not be re-ordered. */ -/*! \fn template bool QAtomicPointer::isFetchAndAddNative() +/*! + \fn template bool QAtomicPointer::isFetchAndAddNative() Returns \c true if fetch-and-add is implemented using atomic processor instructions, false otherwise. */ -/*! \fn template bool QAtomicPointer::isFetchAndAddWaitFree() +/*! + \fn template bool QAtomicPointer::isFetchAndAddWaitFree() Returns \c true if atomic fetch-and-add is wait-free, false otherwise. */ -/*! \fn template T *QAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1526,7 +1591,8 @@ processor to freely reorder memory accesses. */ -/*! \fn template T *QAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1539,7 +1605,8 @@ be re-ordered before the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) Atomic fetch-and-add. @@ -1552,7 +1619,8 @@ re-ordered after the atomic operation. */ -/*! \fn template T *QAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) +/*! + \fn template T *QAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) Atomic fetch-and-add. diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index a3b9be0729..aa57ddc610 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -50,6 +50,10 @@ QT_BEGIN_NAMESPACE QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wextra") +#ifdef Q_CLANG_QDOC +# undef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS +#endif + // High-level atomic integer operations template class QAtomicInteger : public QBasicAtomicInteger @@ -194,7 +198,9 @@ public: #ifdef Q_QDOC T *load() const; T *loadAcquire() const; + T *loadRelaxed() const; void store(T *newValue); + void storeRelaxed(T *newValue); void storeRelease(T *newValue); static Q_DECL_CONSTEXPR bool isTestAndSetNative(); diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index c4e7d32de1..392b6040cb 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -62,7 +62,7 @@ \include module-use.qdocinc using qt module \quotefile overview/using-qt-gui.cmake - See also the \l[QtDoc]{Building with CMake} overview. + See also the \l[QtDoc]{Build with CMake} overview. \section2 Building with qmake diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index b71a0c54aa..f701755500 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1344,7 +1344,7 @@ Qt::WindowStates QWindow::windowStates() const This is a hint to the window manager that this window is a dialog or pop-up on behalf of the transient parent. - In order to cause the window to be centered above its transient parent by + In order to cause the window to be centered above its transient \a parent by default, depending on the window manager, it may also be necessary to call setFlags() with a suitable \l Qt::WindowType (such as \c Qt::Dialog). diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index e302aa1761..4e9e947263 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1512,7 +1512,7 @@ bool QSslSocket::addDefaultCaCertificates(const QString &path, QSsl::EncodingFor SSL socket's CA certificate database is initialized to the default CA certificate database. - \sa QSslConfiguration::caCertificates(), addCaCertificates() + \sa addCaCertificates() */ void QSslSocket::addDefaultCaCertificate(const QSslCertificate &certificate) { diff --git a/src/testlib/doc/src/qttest-best-practices.qdoc b/src/testlib/doc/src/qttest-best-practices.qdoc index c7fee93c80..8ad67acce6 100644 --- a/src/testlib/doc/src/qttest-best-practices.qdoc +++ b/src/testlib/doc/src/qttest-best-practices.qdoc @@ -278,8 +278,8 @@ \section2 Avoid Fixed Timeouts Avoid using hard-coded timeouts, such as QTest::qWait() to wait for some - conditions to become true. Consider using the \l QtSignalSpy class, - the \l QTRY_VERIFY() or \l QTRY_COMPARE() macros, or the \c QtSignalSpy + conditions to become true. Consider using the \l QSignalSpy class, + the \l QTRY_VERIFY() or \l QTRY_COMPARE() macros, or the \c QSignalSpy class in conjunction with the \c QTRY_ macro variants. The \c qWait() function can be used to set a delay for a fixed period diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp index 01cadd9a86..237d496e0e 100644 --- a/src/widgets/styles/qstyleoption.cpp +++ b/src/widgets/styles/qstyleoption.cpp @@ -1453,7 +1453,7 @@ QStyleOptionTab::QStyleOptionTab(int version) \value None A normal tab button. \value HasFrame The tab button is positioned on a tab frame - \sa features + \sa QStyleOptionToolBar::features */ /*! -- cgit v1.2.3 From c496fee2a5b65fd1b0672923293db058486e350e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 11 Oct 2019 14:10:39 -0700 Subject: qSwap: suppress pedantic warning about noexcept being false This warning is not in -Wall or -Wextra, but it happens in a single place, so we can reasonably suppress it. Fixes: QTBUG-79138 Change-Id: Ib5d667bf77a740c28d2efffd15ccb3f62cf8f431 Reviewed-by: Edward Welbourne Reviewed-by: Allan Sandfeld Jensen --- src/corelib/global/qglobal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e335916eac..e636a7cf8f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -944,6 +944,10 @@ QT_WARNING_POP # define Q_DUMMY_COMPARISON_OPERATOR(C) #endif +QT_WARNING_PUSH +// warning: noexcept-expression evaluates to ‘false’ because of a call to ‘void swap(..., ...)' +QT_WARNING_DISABLE_GCC("-Wnoexcept") + namespace QtPrivate { namespace SwapExceptionTester { // insulate users from the "using std::swap" below @@ -963,6 +967,8 @@ inline void qSwap(T &value1, T &value2) swap(value1, value2); } +QT_WARNING_POP + #if QT_DEPRECATED_SINCE(5, 0) Q_CORE_EXPORT QT_DEPRECATED void *qMalloc(size_t size) Q_ALLOC_SIZE(1); Q_CORE_EXPORT QT_DEPRECATED void qFree(void *ptr); -- cgit v1.2.3 From 23d23125068f98f4e6bb1ed3bc9899cefd8cbbf4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 29 Oct 2019 13:50:22 +0100 Subject: Split cborstream feature in two Reading of Cbor streams is substantially more complicated than writing as it requires float16 support. When writing Cbor, we can just choose to always write 32bit floats, even if we could compress the numbers into 16 bits. We need Cbor writing in the bootstrap library, but we cannot easily add float16 support. Furthermore, Cbor reading is required for plugin support, but not Cbor writing. It might make sense for some users to build a custom Qt with Cbor writing disabled. Therefore, provide two features, cborstreamreader and cborstreamwriter, split up the code in cborstream.{h|cpp} into several files, and enable Cbor writing in the bootstrap library. Change-Id: I15450afb0e328a84a22ebca9379cffc4f900a75a Reviewed-by: Thiago Macieira --- src/corelib/configure.json | 12 +- src/corelib/global/qconfig-bootstrapped.h | 3 +- src/corelib/serialization/qcborcommon.cpp | 328 +++ src/corelib/serialization/qcborcommon.h | 2 + src/corelib/serialization/qcborcommon_p.h | 84 + src/corelib/serialization/qcborstream.cpp | 2649 ----------------------- src/corelib/serialization/qcborstream.h | 226 +- src/corelib/serialization/qcborstreamreader.cpp | 1533 +++++++++++++ src/corelib/serialization/qcborstreamreader.h | 210 ++ src/corelib/serialization/qcborstreamwriter.cpp | 868 ++++++++ src/corelib/serialization/qcborstreamwriter.h | 130 ++ src/corelib/serialization/qcborvalue.cpp | 34 +- src/corelib/serialization/qcborvalue.h | 8 +- src/corelib/serialization/serialization.pri | 17 +- src/tools/bootstrap/bootstrap.pro | 6 + 15 files changed, 3223 insertions(+), 2887 deletions(-) create mode 100644 src/corelib/serialization/qcborcommon.cpp create mode 100644 src/corelib/serialization/qcborcommon_p.h delete mode 100644 src/corelib/serialization/qcborstream.cpp create mode 100644 src/corelib/serialization/qcborstreamreader.cpp create mode 100644 src/corelib/serialization/qcborstreamreader.h create mode 100644 src/corelib/serialization/qcborstreamwriter.cpp create mode 100644 src/corelib/serialization/qcborstreamwriter.h (limited to 'src') diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 04643aec33..eb60ad213c 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -1087,14 +1087,20 @@ Mozilla License) is included. The data is then also used in QNetworkCookieJar::v "label": "Windows System Libraries", "condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32" }, - "cborstream": { - "label": "CBOR stream I/O", - "purpose": "Provides support for reading and writing the CBOR binary format. + "cborstreamreader": { + "label": "CBOR stream reading", + "purpose": "Provides support for reading the CBOR binary format. Note that this is required for plugin loading. Qt GUI needs QPA plugins for basic operation.", "section": "Utilities", "output": [ "publicFeature" ] }, + "cborstreamwriter": { + "label": "CBOR stream writing", + "purpose": "Provides support for writing the CBOR binary format.", + "section": "Utilities", + "output": [ "publicFeature" ] + }, "binaryjson": { "label": "Binary JSON (deprecated)", "purpose": "Provides support for the deprecated binary JSON format.", diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index b62c1a4d35..b3daf43c04 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -75,7 +75,8 @@ # define QT_FEATURE_alloca_malloc_h -1 #endif #define QT_FEATURE_binaryjson -1 -#define QT_FEATURE_cborstream -1 +#define QT_FEATURE_cborstreamreader -1 +#define QT_FEATURE_cborstreamwriter 1 #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_FEATURE_cxx11_random (__has_include() ? 1 : -1) #define QT_NO_DATASTREAM diff --git a/src/corelib/serialization/qcborcommon.cpp b/src/corelib/serialization/qcborcommon.cpp new file mode 100644 index 0000000000..37fb198744 --- /dev/null +++ b/src/corelib/serialization/qcborcommon.cpp @@ -0,0 +1,328 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define CBOR_NO_ENCODER_API +#define CBOR_NO_PARSER_API +#include "qcborcommon_p.h" + +#include + +QT_BEGIN_NAMESPACE + +#include + +/*! + \headerfile + + \brief The header contains definitions common to both the + streaming classes (QCborStreamReader and QCborStreamWriter) and to + QCborValue. + */ + +/*! + \enum QCborSimpleType + \relates + + This enum contains the possible "Simple Types" for CBOR. Simple Types range + from 0 to 255 and are types that carry no further value. + + The following values are currently known: + + \value False A "false" boolean. + \value True A "true" boolean. + \value Null Absence of value (null). + \value Undefined Missing or deleted value, usually an error. + + Qt CBOR API supports encoding and decoding any Simple Type, whether one of + those above or any other value. + + Applications should only use further values if a corresponding specification + has been published, otherwise interpretation and validation by the remote + may fail. Values 24 to 31 are reserved and must not be used. + + The current authoritative list is maintained by IANA in the + \l{https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xml}{Simple + Values registry}. + + \sa QCborStreamWriter::append(QCborSimpleType), QCborStreamReader::isSimpleType(), + QCborStreamReader::toSimpleType(), QCborValue::isSimpleType(), QCborValue::toSimpleType() + */ + +#if !defined(QT_NO_DATASTREAM) +QDataStream &operator<<(QDataStream &ds, QCborSimpleType st) +{ + return ds << quint8(st); +} + +QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st) +{ + quint8 v; + ds >> v; + st = QCborSimpleType(v); + return ds; +} +#endif + +/*! + \enum QCborTag + \relates + + This enum contains no enumeration and is used only to provide type-safe + access to a CBOR tag. + + CBOR tags are 64-bit numbers that are attached to generic CBOR types to + provide further semantic meaning. QCborTag may be constructed from an + enumeration found in QCborKnownTags or directly by providing the numeric + representation. + + For example, the following creates a QCborValue containing a byte array + tagged with a tag 2. + + \snippet code/src_corelib_serialization_qcborstream.cpp 0 + + \sa QCborKnownTags, QCborStreamWriter::append(QCborTag), + QCborStreamReader::isTag(), QCborStreamReader::toTag(), + QCborValue::isTag(), QCborValue::tag() + */ + +/*! + \enum QCborKnownTags + \relates + + This enum contains a list of CBOR tags, known at the time of the Qt + implementation. This list is not meant to be complete and contains only + tags that are either backed by an RFC or specifically used by the Qt + implementation. + + The authoritative list is maintained by IANA in the + \l{https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml}{CBOR tag + registry}. + + \value DateTimeString A date and time string, formatted according to RFC 3339, as refined + by RFC 4287. It is the same format as Qt::ISODate and + Qt::ISODateWithMs. + \value UnixTime_t A numerical representation of seconds elapsed since + 1970-01-01T00:00Z. + \value PositiveBignum A positive number of arbitrary length, encoded as a byte array in + network byte order. For example, the number 2\sup{64} is represented by + a byte array containing the byte value 0x01 followed by 8 zero bytes. + \value NegativeBignum A negative number of arbirary length, encoded as the absolute value + of that number, minus one. For example, a byte array containing + byte value 0x02 followed by 8 zero bytes represents the number + -2\sup{65} - 1. + \value Decimal A decimal fraction, encoded as an array of two integers: the first + is the exponent of the power of 10, the second the integral + mantissa. The value 273.15 would be encoded as array \c{[-2, 27315]}. + \value Bigfloat Similar to Decimal, but the exponent is a power of 2 instead. + \value COSE_Encrypt0 An \c Encrypt0 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value COSE_Mac0 A \c Mac0 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value COSE_Sign1 A \c Sign1 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value ExpectedBase64url Indicates that the byte array should be encoded using Base64url + if the stream is converted to JSON. + \value ExpectedBase64 Indicates that the byte array should be encoded using Base64 + if the stream is converted to JSON. + \value ExpectedBase16 Indicates that the byte array should be encoded using Base16 (hex) + if the stream is converted to JSON. + \value EncodedCbor Indicates that the byte array contains a CBOR stream. + \value Url Indicates that the string contains a URL. + \value Base64url Indicates that the string contains data encoded using Base64url. + \value Base64 Indicates that the string contains data encoded using Base64. + \value RegularExpression Indicates that the string contains a Perl-Compatible Regular + Expression pattern. + \value MimeMessage Indicates that the string contains a MIME message (according to + \l{https://tools.ietf.org/html/rfc2045}){RFC 2045}. + \value Uuid Indicates that the byte array contains a UUID. + \value COSE_Encrypt An \c Encrypt map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value COSE_Mac A \c Mac map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value COSE_Sign A \c Sign map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} + (CBOR Object Signing and Encryption). + \value Signature No change in interpretation; this tag can be used as the outermost + tag in a CBOR stream as the file header. + + The following tags are interpreted by QCborValue during decoding and will + produce objects with extended Qt types, and it will use those tags when + encoding the same extended types. + + \value DateTimeString \l QDateTime + \value UnixTime_t \l QDateTime (only in decoding) + \value Url \l QUrl + \value Uuid \l QUuid + + Additionally, if a QCborValue containing a QByteArray is tagged using one of + \c ExpectedBase64url, \c ExpectedBase64 or \c ExpectedBase16, QCborValue + will use the expected encoding when converting to JSON (see + QCborValue::toJsonValue). + + \sa QCborTag, QCborStreamWriter::append(QCborTag), + QCborStreamReader::isTag(), QCborStreamReader::toTag(), + QCborValue::isTag(), QCborValue::tag() + */ + +/*! + \class QCborError + \inmodule QtCore + \relates + \reentrant + \since 5.12 + + \brief The QCborError class holds the error condition found while parsing or + validating a CBOR stream. + + \sa QCborStreamReader, QCborValue, QCborParserError + */ + +/*! + \enum QCborError::Code + + This enum contains the possible error condition codes. + + \value NoError No error was detected. + \value UnknownError An unknown error occurred and no further details are available. + \value AdvancePastEnd QCborStreamReader::next() was called but there are no more elements in + the current context. + \value InputOutputError An I/O error with the QIODevice occurred. + \value GarbageAtEnd Data was found in the input stream after the last element. + \value EndOfFile The end of the input stream was unexpectedly reached while processing an + element. + \value UnexpectedBreak The CBOR stream contains a Break where it is not allowed (data is + corrupt and the error is not recoverable). + \value UnknownType The CBOR stream contains an unknown/unparseable Type (data is corrupt + and the and the error is not recoverable). + \value IllegalType The CBOR stream contains a known type in a position it is not allowed + to exist (data is corrupt and the error is not recoverable). + \value IllegalNumber The CBOR stream appears to be encoding a number larger than 64-bit + (data is corrupt and the error is not recoverable). + \value IllegalSimpleType The CBOR stream contains a Simple Type encoded incorrectly (data is + corrupt and the error is not recoverable). + \value InvalidUtf8String The CBOR stream contains a text string that does not decode properly + as UTF-8 (data is corrupt and the error is not recoverable). + \value DataTooLarge CBOR string, map or array is too big and cannot be parsed by Qt + (internal limitation, but the error is not recoverable). + \value NestingTooDeep Too many levels of arrays or maps encountered while processing the + input (internal limitation, but the error is not recoverable). + \value UnsupportedType The CBOR stream contains a known type that the implementation does not + support (internal limitation, but the error is not recoverable). + */ + +/*! + \variable QCborError::c + \internal + */ + +/*! + \fn QCborError::operator Code() const + + Returns the error code that this QCborError object stores. + */ + +/*! + Returns a text string that matches the error code in this QCborError object. + + Note: the string is not translated. Applications whose interface allow users + to parse CBOR streams need to provide their own, translated strings. + + \sa QCborError::Code + */ +QString QCborError::toString() const +{ + switch (c) { + case NoError: + Q_STATIC_ASSERT(int(NoError) == int(CborNoError)); + return QString(); + + case UnknownError: + Q_STATIC_ASSERT(int(UnknownError) == int(CborUnknownError)); + return QStringLiteral("Unknown error"); + case AdvancePastEnd: + Q_STATIC_ASSERT(int(AdvancePastEnd) == int(CborErrorAdvancePastEOF)); + return QStringLiteral("Read past end of buffer (more bytes needed)"); + case InputOutputError: + Q_STATIC_ASSERT(int(InputOutputError) == int(CborErrorIO)); + return QStringLiteral("Input/Output error"); + case GarbageAtEnd: + Q_STATIC_ASSERT(int(GarbageAtEnd) == int(CborErrorGarbageAtEnd)); + return QStringLiteral("Data found after the end of the stream"); + case EndOfFile: + Q_STATIC_ASSERT(int(EndOfFile) == int(CborErrorUnexpectedEOF)); + return QStringLiteral("Unexpected end of input data (more bytes needed)"); + case UnexpectedBreak: + Q_STATIC_ASSERT(int(UnexpectedBreak) == int(CborErrorUnexpectedBreak)); + return QStringLiteral("Invalid CBOR stream: unexpected 'break' byte"); + case UnknownType: + Q_STATIC_ASSERT(int(UnknownType) == int(CborErrorUnknownType)); + return QStringLiteral("Invalid CBOR stream: unknown type"); + case IllegalType: + Q_STATIC_ASSERT(int(IllegalType) == int(CborErrorIllegalType)); + return QStringLiteral("Invalid CBOR stream: illegal type found"); + case IllegalNumber: + Q_STATIC_ASSERT(int(IllegalNumber) == int(CborErrorIllegalNumber)); + return QStringLiteral("Invalid CBOR stream: illegal number encoding (future extension)"); + case IllegalSimpleType: + Q_STATIC_ASSERT(int(IllegalSimpleType) == int(CborErrorIllegalSimpleType)); + return QStringLiteral("Invalid CBOR stream: illegal simple type"); + case InvalidUtf8String: + Q_STATIC_ASSERT(int(InvalidUtf8String) == int(CborErrorInvalidUtf8TextString)); + return QStringLiteral("Invalid CBOR stream: invalid UTF-8 text string"); + case DataTooLarge: + Q_STATIC_ASSERT(int(DataTooLarge) == int(CborErrorDataTooLarge)); + return QStringLiteral("Internal limitation: data set too large"); + case NestingTooDeep: + Q_STATIC_ASSERT(int(NestingTooDeep) == int(CborErrorNestingTooDeep)); + return QStringLiteral("Internal limitation: data nesting too deep"); + case UnsupportedType: + Q_STATIC_ASSERT(int(UnsupportedType) == int(CborErrorUnsupportedType)); + return QStringLiteral("Internal limitation: unsupported type"); + } + + // get the error string from TinyCBOR + CborError err = CborError(int(c)); + return QString::fromLatin1(cbor_error_string(err)); +} + +QT_END_NAMESPACE + +#ifndef QT_BOOTSTRAPPED +#include "moc_qcborcommon.cpp" +#endif diff --git a/src/corelib/serialization/qcborcommon.h b/src/corelib/serialization/qcborcommon.h index 3dfe50cd09..bec46399ce 100644 --- a/src/corelib/serialization/qcborcommon.h +++ b/src/corelib/serialization/qcborcommon.h @@ -148,6 +148,8 @@ inline uint qHash(QCborTag tag, uint seed = 0) return qHash(quint64(tag), seed); } +enum class QCborNegativeInteger : quint64 {}; + QT_END_NAMESPACE Q_DECLARE_METATYPE(QCborTag) diff --git a/src/corelib/serialization/qcborcommon_p.h b/src/corelib/serialization/qcborcommon_p.h new file mode 100644 index 0000000000..9b7f4b7099 --- /dev/null +++ b/src/corelib/serialization/qcborcommon_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCBORCOMMON_P_H +#define QCBORCOMMON_P_H + +#include "qcborcommon.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. +// + +QT_BEGIN_NAMESPACE + +#ifdef QT_NO_DEBUG +# define NDEBUG 1 +#endif +#undef assert +#define assert Q_ASSERT + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wunused-function") +QT_WARNING_DISABLE_CLANG("-Wunused-function") +QT_WARNING_DISABLE_CLANG("-Wundefined-internal") + +#define CBOR_NO_VALIDATION_API 1 +#define CBOR_NO_PRETTY_API 1 +#define CBOR_API static inline +#define CBOR_PRIVATE_API static inline +#define CBOR_INLINE_API static inline + +#include + +QT_WARNING_POP + +Q_DECLARE_TYPEINFO(CborValue, Q_PRIMITIVE_TYPE); + +QT_END_NAMESPACE + +#endif // QCBORCOMMON_P_H diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp deleted file mode 100644 index a232f7eef7..0000000000 --- a/src/corelib/serialization/qcborstream.cpp +++ /dev/null @@ -1,2649 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Intel Corporation. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qcborstream.h" - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#ifdef QT_NO_DEBUG -# define NDEBUG 1 -#endif -#undef assert -#define assert Q_ASSERT - -QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wunused-function") -QT_WARNING_DISABLE_CLANG("-Wunused-function") -QT_WARNING_DISABLE_CLANG("-Wundefined-internal") -QT_WARNING_DISABLE_MSVC(4334) // '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) - -#define CBOR_ENCODER_NO_CHECK_USER - -#define CBOR_NO_VALIDATION_API 1 -#define CBOR_NO_PRETTY_API 1 -#define CBOR_API static inline -#define CBOR_PRIVATE_API static inline -#define CBOR_INLINE_API static inline - -#include - -static CborError qt_cbor_encoder_write_callback(void *token, const void *data, size_t len, CborEncoderAppendType); -static bool qt_cbor_decoder_can_read(void *token, size_t len); -static void qt_cbor_decoder_advance(void *token, size_t len); -static void *qt_cbor_decoder_read(void *token, void *userptr, size_t offset, size_t len); -static CborError qt_cbor_decoder_transfer_string(void *token, const void **userptr, size_t offset, size_t len); - -#define CBOR_ENCODER_WRITER_CONTROL 1 -#define CBOR_ENCODER_WRITE_FUNCTION qt_cbor_encoder_write_callback - -#define CBOR_PARSER_READER_CONTROL 1 -#define CBOR_PARSER_CAN_READ_BYTES_FUNCTION qt_cbor_decoder_can_read -#define CBOR_PARSER_ADVANCE_BYTES_FUNCTION qt_cbor_decoder_advance -#define CBOR_PARSER_TRANSFER_STRING_FUNCTION qt_cbor_decoder_transfer_string -#define CBOR_PARSER_READ_BYTES_FUNCTION qt_cbor_decoder_read - -#include "../3rdparty/tinycbor/src/cborencoder.c" -#include "../3rdparty/tinycbor/src/cborerrorstrings.c" -#include "../3rdparty/tinycbor/src/cborparser.c" - -// silence compilers that complain about this being a static function declared -// but never defined -static CborError cbor_encoder_close_container_checked(CborEncoder*, const CborEncoder*) -{ - Q_UNREACHABLE(); - return CborErrorInternalError; -} -static CborError _cbor_value_dup_string(const CborValue *, void **, size_t *, CborValue *) -{ - Q_UNREACHABLE(); - return CborErrorInternalError; -} -static CborError cbor_value_get_half_float_as_float(const CborValue *, float *) -{ - Q_UNREACHABLE(); - return CborErrorInternalError; -} -static CborError cbor_encode_float_as_half_float(CborEncoder *, float) -{ - Q_UNREACHABLE(); - return CborErrorInternalError; -} -QT_WARNING_POP - -Q_DECLARE_TYPEINFO(CborEncoder, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(CborValue, Q_PRIMITIVE_TYPE); - -// confirm our constants match TinyCBOR's -Q_STATIC_ASSERT(int(QCborStreamReader::UnsignedInteger) == CborIntegerType); -Q_STATIC_ASSERT(int(QCborStreamReader::ByteString) == CborByteStringType); -Q_STATIC_ASSERT(int(QCborStreamReader::TextString) == CborTextStringType); -Q_STATIC_ASSERT(int(QCborStreamReader::Array) == CborArrayType); -Q_STATIC_ASSERT(int(QCborStreamReader::Map) == CborMapType); -Q_STATIC_ASSERT(int(QCborStreamReader::Tag) == CborTagType); -Q_STATIC_ASSERT(int(QCborStreamReader::SimpleType) == CborSimpleType); -Q_STATIC_ASSERT(int(QCborStreamReader::HalfFloat) == CborHalfFloatType); -Q_STATIC_ASSERT(int(QCborStreamReader::Float) == CborFloatType); -Q_STATIC_ASSERT(int(QCborStreamReader::Double) == CborDoubleType); -Q_STATIC_ASSERT(int(QCborStreamReader::Invalid) == CborInvalidType); - -/*! - \headerfile - - \brief The header contains definitions common to both the - streaming classes (QCborStreamReader and QCborStreamWriter) and to - QCborValue. - */ - -/*! - \enum QCborSimpleType - \relates - - This enum contains the possible "Simple Types" for CBOR. Simple Types range - from 0 to 255 and are types that carry no further value. - - The following values are currently known: - - \value False A "false" boolean. - \value True A "true" boolean. - \value Null Absence of value (null). - \value Undefined Missing or deleted value, usually an error. - - Qt CBOR API supports encoding and decoding any Simple Type, whether one of - those above or any other value. - - Applications should only use further values if a corresponding specification - has been published, otherwise interpretation and validation by the remote - may fail. Values 24 to 31 are reserved and must not be used. - - The current authoritative list is maintained by IANA in the - \l{https://www.iana.org/assignments/cbor-simple-values/cbor-simple-values.xml}{Simple - Values registry}. - - \sa QCborStreamWriter::append(QCborSimpleType), QCborStreamReader::isSimpleType(), - QCborStreamReader::toSimpleType(), QCborValue::isSimpleType(), QCborValue::toSimpleType() - */ - -#if !defined(QT_NO_DATASTREAM) -QDataStream &operator<<(QDataStream &ds, QCborSimpleType st) -{ - return ds << quint8(st); -} - -QDataStream &operator>>(QDataStream &ds, QCborSimpleType &st) -{ - quint8 v; - ds >> v; - st = QCborSimpleType(v); - return ds; -} -#endif - -/*! - \enum QCborTag - \relates - - This enum contains no enumeration and is used only to provide type-safe - access to a CBOR tag. - - CBOR tags are 64-bit numbers that are attached to generic CBOR types to - provide further semantic meaning. QCborTag may be constructed from an - enumeration found in QCborKnownTags or directly by providing the numeric - representation. - - For example, the following creates a QCborValue containing a byte array - tagged with a tag 2. - - \snippet code/src_corelib_serialization_qcborstream.cpp 0 - - \sa QCborKnownTags, QCborStreamWriter::append(QCborTag), - QCborStreamReader::isTag(), QCborStreamReader::toTag(), - QCborValue::isTag(), QCborValue::tag() - */ - -/*! - \enum QCborKnownTags - \relates - - This enum contains a list of CBOR tags, known at the time of the Qt - implementation. This list is not meant to be complete and contains only - tags that are either backed by an RFC or specifically used by the Qt - implementation. - - The authoritative list is maintained by IANA in the - \l{https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml}{CBOR tag - registry}. - - \value DateTimeString A date and time string, formatted according to RFC 3339, as refined - by RFC 4287. It is the same format as Qt::ISODate and - Qt::ISODateWithMs. - \value UnixTime_t A numerical representation of seconds elapsed since - 1970-01-01T00:00Z. - \value PositiveBignum A positive number of arbitrary length, encoded as a byte array in - network byte order. For example, the number 2\sup{64} is represented by - a byte array containing the byte value 0x01 followed by 8 zero bytes. - \value NegativeBignum A negative number of arbirary length, encoded as the absolute value - of that number, minus one. For example, a byte array containing - byte value 0x02 followed by 8 zero bytes represents the number - -2\sup{65} - 1. - \value Decimal A decimal fraction, encoded as an array of two integers: the first - is the exponent of the power of 10, the second the integral - mantissa. The value 273.15 would be encoded as array \c{[-2, 27315]}. - \value Bigfloat Similar to Decimal, but the exponent is a power of 2 instead. - \value COSE_Encrypt0 An \c Encrypt0 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value COSE_Mac0 A \c Mac0 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value COSE_Sign1 A \c Sign1 map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value ExpectedBase64url Indicates that the byte array should be encoded using Base64url - if the stream is converted to JSON. - \value ExpectedBase64 Indicates that the byte array should be encoded using Base64 - if the stream is converted to JSON. - \value ExpectedBase16 Indicates that the byte array should be encoded using Base16 (hex) - if the stream is converted to JSON. - \value EncodedCbor Indicates that the byte array contains a CBOR stream. - \value Url Indicates that the string contains a URL. - \value Base64url Indicates that the string contains data encoded using Base64url. - \value Base64 Indicates that the string contains data encoded using Base64. - \value RegularExpression Indicates that the string contains a Perl-Compatible Regular - Expression pattern. - \value MimeMessage Indicates that the string contains a MIME message (according to - \l{https://tools.ietf.org/html/rfc2045}){RFC 2045}. - \value Uuid Indicates that the byte array contains a UUID. - \value COSE_Encrypt An \c Encrypt map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value COSE_Mac A \c Mac map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value COSE_Sign A \c Sign map as specified by \l{https://tools.ietf.org/html/rfc8152}{RFC 8152} - (CBOR Object Signing and Encryption). - \value Signature No change in interpretation; this tag can be used as the outermost - tag in a CBOR stream as the file header. - - The following tags are interpreted by QCborValue during decoding and will - produce objects with extended Qt types, and it will use those tags when - encoding the same extended types. - - \value DateTimeString \l QDateTime - \value UnixTime_t \l QDateTime (only in decoding) - \value Url \l QUrl - \value Uuid \l QUuid - - Additionally, if a QCborValue containing a QByteArray is tagged using one of - \c ExpectedBase64url, \c ExpectedBase64 or \c ExpectedBase16, QCborValue - will use the expected encoding when converting to JSON (see - QCborValue::toJsonValue). - - \sa QCborTag, QCborStreamWriter::append(QCborTag), - QCborStreamReader::isTag(), QCborStreamReader::toTag(), - QCborValue::isTag(), QCborValue::tag() - */ - -/*! - \class QCborError - \inmodule QtCore - \relates - \reentrant - \since 5.12 - - \brief The QCborError class holds the error condition found while parsing or - validating a CBOR stream. - - \sa QCborStreamReader, QCborValue, QCborParserError - */ - -/*! - \enum QCborError::Code - - This enum contains the possible error condition codes. - - \value NoError No error was detected. - \value UnknownError An unknown error occurred and no further details are available. - \value AdvancePastEnd QCborStreamReader::next() was called but there are no more elements in - the current context. - \value InputOutputError An I/O error with the QIODevice occurred. - \value GarbageAtEnd Data was found in the input stream after the last element. - \value EndOfFile The end of the input stream was unexpectedly reached while processing an - element. - \value UnexpectedBreak The CBOR stream contains a Break where it is not allowed (data is - corrupt and the error is not recoverable). - \value UnknownType The CBOR stream contains an unknown/unparseable Type (data is corrupt - and the and the error is not recoverable). - \value IllegalType The CBOR stream contains a known type in a position it is not allowed - to exist (data is corrupt and the error is not recoverable). - \value IllegalNumber The CBOR stream appears to be encoding a number larger than 64-bit - (data is corrupt and the error is not recoverable). - \value IllegalSimpleType The CBOR stream contains a Simple Type encoded incorrectly (data is - corrupt and the error is not recoverable). - \value InvalidUtf8String The CBOR stream contains a text string that does not decode properly - as UTF-8 (data is corrupt and the error is not recoverable). - \value DataTooLarge CBOR string, map or array is too big and cannot be parsed by Qt - (internal limitation, but the error is not recoverable). - \value NestingTooDeep Too many levels of arrays or maps encountered while processing the - input (internal limitation, but the error is not recoverable). - \value UnsupportedType The CBOR stream contains a known type that the implementation does not - support (internal limitation, but the error is not recoverable). - */ - -// Convert from CborError to QCborError. -// -// Centralized in a function in case we need to make more adjustments in the -// future. -static QCborError fromCborError(CborError err) -{ - return { QCborError::Code(int(err)) }; -} - -// Convert to CborError from QCborError. -// -// Centralized in a function in case we need to make more adjustments in the -// future. -static CborError toCborError(QCborError c) -{ - return CborError(int(c.c)); -} - -/*! - \variable QCborError::c - \internal - */ - -/*! - \fn QCborError::operator Code() const - - Returns the error code that this QCborError object stores. - */ - -/*! - Returns a text string that matches the error code in this QCborError object. - - Note: the string is not translated. Applications whose interface allow users - to parse CBOR streams need to provide their own, translated strings. - - \sa QCborError::Code - */ -QString QCborError::toString() const -{ - switch (c) { - case NoError: - Q_STATIC_ASSERT(int(NoError) == int(CborNoError)); - return QString(); - - case UnknownError: - Q_STATIC_ASSERT(int(UnknownError) == int(CborUnknownError)); - return QStringLiteral("Unknown error"); - case AdvancePastEnd: - Q_STATIC_ASSERT(int(AdvancePastEnd) == int(CborErrorAdvancePastEOF)); - return QStringLiteral("Read past end of buffer (more bytes needed)"); - case InputOutputError: - Q_STATIC_ASSERT(int(InputOutputError) == int(CborErrorIO)); - return QStringLiteral("Input/Output error"); - case GarbageAtEnd: - Q_STATIC_ASSERT(int(GarbageAtEnd) == int(CborErrorGarbageAtEnd)); - return QStringLiteral("Data found after the end of the stream"); - case EndOfFile: - Q_STATIC_ASSERT(int(EndOfFile) == int(CborErrorUnexpectedEOF)); - return QStringLiteral("Unexpected end of input data (more bytes needed)"); - case UnexpectedBreak: - Q_STATIC_ASSERT(int(UnexpectedBreak) == int(CborErrorUnexpectedBreak)); - return QStringLiteral("Invalid CBOR stream: unexpected 'break' byte"); - case UnknownType: - Q_STATIC_ASSERT(int(UnknownType) == int(CborErrorUnknownType)); - return QStringLiteral("Invalid CBOR stream: unknown type"); - case IllegalType: - Q_STATIC_ASSERT(int(IllegalType) == int(CborErrorIllegalType)); - return QStringLiteral("Invalid CBOR stream: illegal type found"); - case IllegalNumber: - Q_STATIC_ASSERT(int(IllegalNumber) == int(CborErrorIllegalNumber)); - return QStringLiteral("Invalid CBOR stream: illegal number encoding (future extension)"); - case IllegalSimpleType: - Q_STATIC_ASSERT(int(IllegalSimpleType) == int(CborErrorIllegalSimpleType)); - return QStringLiteral("Invalid CBOR stream: illegal simple type"); - case InvalidUtf8String: - Q_STATIC_ASSERT(int(InvalidUtf8String) == int(CborErrorInvalidUtf8TextString)); - return QStringLiteral("Invalid CBOR stream: invalid UTF-8 text string"); - case DataTooLarge: - Q_STATIC_ASSERT(int(DataTooLarge) == int(CborErrorDataTooLarge)); - return QStringLiteral("Internal limitation: data set too large"); - case NestingTooDeep: - Q_STATIC_ASSERT(int(NestingTooDeep) == int(CborErrorNestingTooDeep)); - return QStringLiteral("Internal limitation: data nesting too deep"); - case UnsupportedType: - Q_STATIC_ASSERT(int(UnsupportedType) == int(CborErrorUnsupportedType)); - return QStringLiteral("Internal limitation: unsupported type"); - } - - // get the error string from TinyCBOR - CborError err = toCborError(*this); - return QString::fromLatin1(cbor_error_string(err)); -} - -/*! - \class QCborStreamWriter - \inmodule QtCore - \ingroup cbor - \reentrant - \since 5.12 - - \brief The QCborStreamWriter class is a simple CBOR encoder operating on a - one-way stream. - - This class can be used to quickly encode a stream of CBOR content directly - to either a QByteArray or QIODevice. CBOR is the Concise Binary Object - Representation, a very compact form of binary data encoding that is - compatible with JSON. It was created by the IETF Constrained RESTful - Environments (CoRE) WG, which has used it in many new RFCs. It is meant to - be used alongside the \l{https://tools.ietf.org/html/rfc7252}{CoAP - protocol}. - - QCborStreamWriter provides a StAX-like API, similar to that of - \l{QXmlStreamWriter}. It is rather low-level and requires a bit of knowledge - of CBOR encoding. For a simpler API, see \l{QCborValue} and especially the - encoding function QCborValue::toCbor(). - - The typical use of QCborStreamWriter is to create the object on the target - QByteArray or QIODevice, then call one of the append() overloads with the - desired type to be encoded. To create arrays and maps, QCborStreamWriter - provides startArray() and startMap() overloads, which must be terminated by - the corresponding endArray() and endMap() functions. - - The following example encodes the equivalent of this JSON content: - - \div{class="pre"} - { - "label": "journald", - "autoDetect": false, - "condition": "libs.journald", - "output": [ "privateFeature" ] - } - \enddiv - - \snippet code/src_corelib_serialization_qcborstream.cpp 1 - - \section1 CBOR support - - QCborStreamWriter supports all CBOR features required to create canonical - and strict streams. It implements almost all of the features specified in - \l {https://tools.ietf.org/html/rfc7049}{RFC 7049}. - - The following table lists the CBOR features that QCborStreamWriter supports. - - \table - \header \li Feature \li Support - \row \li Unsigned numbers \li Yes (full range) - \row \li Negative numbers \li Yes (full range) - \row \li Byte strings \li Yes - \row \li Text strings \li Yes - \row \li Chunked strings \li No - \row \li Tags \li Yes (arbitrary) - \row \li Booleans \li Yes - \row \li Null \li Yes - \row \li Undefined \li Yes - \row \li Arbitrary simple values \li Yes - \row \li Half-precision float (16-bit) \li Yes - \row \li Single-precision float (32-bit) \li Yes - \row \li Double-precision float (64-bit) \li Yes - \row \li Infinities and NaN floating point \li Yes - \row \li Determinate-length arrays and maps \li Yes - \row \li Indeterminate-length arrays and maps \li Yes - \row \li Map key types other than strings and integers \li Yes (arbitrary) - \endtable - - \section2 Canonical CBOR encoding - - Canonical CBOR encoding is defined by - \l{https://tools.ietf.org/html/rfc7049#section-3.9}{Section 3.9 of RFC - 7049}. Canonical encoding is not a requirement for Qt's CBOR decoding - functionality, but it may be required for some protocols. In particular, - protocols that require the ability to reproduce the same stream identically - may require this. - - In order to be considered "canonical", a CBOR stream must meet the - following requirements: - - \list - \li Integers must be as small as possible. QCborStreamWriter always - does this (no user action is required and it is not possible - to write overlong integers). - \li Array, map and string lengths must be as short as possible. As - above, QCborStreamWriter automatically does this. - \li Arrays, maps and strings must use explicit length. QCborStreamWriter - always does this for strings; for arrays and maps, be sure to call - startArray() and startMap() overloads with explicit length. - \li Keys in every map must be sorted in ascending order. QCborStreamWriter - offers no help in this item: the developer must ensure that before - calling append() for the map pairs. - \li Floating point values should be as small as possible. QCborStreamWriter - will not convert floating point values; it is up to the developer - to perform this check prior to calling append() (see those functions' - examples). - \endlist - - \section2 Strict CBOR mode - - Strict mode is defined by - \l{https://tools.ietf.org/html/rfc7049#section-3.10}{Section 3.10 of RFC - 7049}. As for Canonical encoding above, QCborStreamWriter makes it possible - to create strict CBOR streams, but does not require them or validate that - the output is so. - - \list - \li Keys in a map must be unique. QCborStreamWriter performs no validation - of map keys. - \li Tags may be required to be paired only with the correct types, - according to their specification. QCborStreamWriter performs no - validation of tag usage. - \li Text Strings must be properly-encoded UTF-8. QCborStreamWriter always - writes proper UTF-8 for strings added with append(), but performs no - validation for strings added with appendTextString(). - \endlist - - \section2 Invalid CBOR stream - - It is also possible to misuse QCborStreamWriter and produce invalid CBOR - streams that will fail to be decoded by a receiver. The following actions - will produce invalid streams: - - \list - \li Append a tag and not append the corresponding tagged value - (QCborStreamWriter produces no diagnostic). - \li Append too many or too few items to an array or map with explicit - length (endMap() and endArray() will return false and - QCborStreamWriter will log with qWarning()). - \endlist - - \sa QCborStreamReader, QCborValue, QXmlStreamWriter - */ - -class QCborStreamWriterPrivate -{ -public: - static Q_CONSTEXPR quint64 IndefiniteLength = (std::numeric_limits::max)(); - - QIODevice *device; - CborEncoder encoder; - QStack containerStack; - bool deleteDevice = false; - - QCborStreamWriterPrivate(QIODevice *device) - : device(device) - { - cbor_encoder_init_writer(&encoder, qt_cbor_encoder_write_callback, this); - } - - ~QCborStreamWriterPrivate() - { - if (deleteDevice) - delete device; - } - - template void executeAppend(CborError (*f)(CborEncoder *, Args...), Args... args) - { - f(&encoder, std::forward(args)...); - } - - void createContainer(CborError (*f)(CborEncoder *, CborEncoder *, size_t), quint64 len = IndefiniteLength) - { - Q_STATIC_ASSERT(size_t(IndefiniteLength) == CborIndefiniteLength); - if (sizeof(len) != sizeof(size_t) && len != IndefiniteLength) { - if (Q_UNLIKELY(len >= CborIndefiniteLength)) { - // TinyCBOR can't do this in 32-bit mode - qWarning("QCborStreamWriter: container of size %llu is too big for a 32-bit build; " - "will use indeterminate length instead", len); - len = CborIndefiniteLength; - } - } - - containerStack.push(encoder); - f(&containerStack.top(), &encoder, len); - } - - bool closeContainer() - { - if (containerStack.isEmpty()) { - qWarning("QCborStreamWriter: closing map or array that wasn't open"); - return false; - } - - CborEncoder container = containerStack.pop(); - CborError err = cbor_encoder_close_container(&container, &encoder); - encoder = container; - - if (Q_UNLIKELY(err)) { - if (err == CborErrorTooFewItems) - qWarning("QCborStreamWriter: not enough items added to array or map"); - else if (err == CborErrorTooManyItems) - qWarning("QCborStreamWriter: too many items added to array or map"); - return false; - } - - return true; - } -}; - -static CborError qt_cbor_encoder_write_callback(void *self, const void *data, size_t len, CborEncoderAppendType) -{ - auto that = static_cast(self); - if (!that->device) - return CborNoError; - qint64 written = that->device->write(static_cast(data), len); - return (written == qsizetype(len) ? CborNoError : CborErrorIO); -} - -/*! - Creates a QCborStreamWriter object that will write the stream to \a device. - The device must be opened before the first append() call is made. This - constructor can be used with any class that derives from QIODevice, such as - QFile, QProcess or QTcpSocket. - - QCborStreamWriter has no buffering, so every append() call will result in - one or more calls to the device's \l {QIODevice::}{write()} method. - - The following example writes an empty map to a file: - - \snippet code/src_corelib_serialization_qcborstream.cpp 2 - - QCborStreamWriter does not take ownership of \a device. - - \sa device(), setDevice() - */ -QCborStreamWriter::QCborStreamWriter(QIODevice *device) - : d(new QCborStreamWriterPrivate(device)) -{ -} - -/*! - Creates a QCborStreamWriter object that will append the stream to \a data. - All streaming is done immediately to the byte array, without the need for - flushing any buffers. - - The following example writes a number to a byte array then returns - it. - - \snippet code/src_corelib_serialization_qcborstream.cpp 3 - - QCborStreamWriter does not take ownership of \a data. - */ -QCborStreamWriter::QCborStreamWriter(QByteArray *data) - : d(new QCborStreamWriterPrivate(new QBuffer(data))) -{ - d->deleteDevice = true; - d->device->open(QIODevice::WriteOnly | QIODevice::Unbuffered); -} - -/*! - Destroys this QCborStreamWriter object and frees any resources associated. - - QCborStreamWriter does not perform error checking to see if all required - items were written to the stream prior to the object being destroyed. It is - the programmer's responsibility to ensure that it was done. - */ -QCborStreamWriter::~QCborStreamWriter() -{ -} - -/*! - Replaces the device or byte array that this QCborStreamWriter object is - writing to with \a device. - - \sa device() - */ -void QCborStreamWriter::setDevice(QIODevice *device) -{ - if (d->deleteDevice) - delete d->device; - d->device = device; - d->deleteDevice = false; -} - -/*! - Returns the QIODevice that this QCborStreamWriter object is writing to. The - device must have previously been set with either the constructor or with - setDevice(). - - If this object was created by writing to a QByteArray, this function will - return an internal instance of QBuffer, which is owned by QCborStreamWriter. - - \sa setDevice() - */ -QIODevice *QCborStreamWriter::device() const -{ - return d->device; -} - -/*! - \overload - - Appends the 64-bit unsigned value \a u to the CBOR stream, creating a CBOR - Unsigned Integer value. In the following example, we write the values 0, - 2\sup{32} and \c UINT64_MAX: - - \snippet code/src_corelib_serialization_qcborstream.cpp 4 - - \sa QCborStreamReader::isUnsignedInteger(), QCborStreamReader::toUnsignedInteger() - */ -void QCborStreamWriter::append(quint64 u) -{ - d->executeAppend(cbor_encode_uint, uint64_t(u)); -} - -/*! - \overload - - Appends the 64-bit signed value \a i to the CBOR stream. This will create - either a CBOR Unsigned Integer or CBOR NegativeInteger value based on the - sign of the parameter. In the following example, we write the values 0, -1, - 2\sup{32} and \c INT64_MAX: - - \snippet code/src_corelib_serialization_qcborstream.cpp 5 - - \sa QCborStreamReader::isInteger(), QCborStreamReader::toInteger() - */ -void QCborStreamWriter::append(qint64 i) -{ - d->executeAppend(cbor_encode_int, int64_t(i)); -} - -/*! - \overload - - Appends the 64-bit negative value \a n to the CBOR stream. - QCborNegativeInteger is a 64-bit enum that holds the absolute value of the - negative number we want to write. If n is zero, the value written will be - equivalent to 2\sup{64} (that is, -18,446,744,073,709,551,616). - - In the following example, we write the values -1, -2\sup{32} and INT64_MIN: - \snippet code/src_corelib_serialization_qcborstream.cpp 6 - - Note how this function can be used to encode numbers that cannot fit a - standard computer's 64-bit signed integer like \l qint64. That is, if \a n - is larger than \c{std::numeric_limits::max()} or is 0, this will - represent a negative number smaller than - \c{std::numeric_limits::min()}. - - \sa QCborStreamReader::isNegativeInteger(), QCborStreamReader::toNegativeInteger() - */ -void QCborStreamWriter::append(QCborNegativeInteger n) -{ - d->executeAppend(cbor_encode_negative_int, uint64_t(n)); -} - -/*! - \fn void QCborStreamWriter::append(const QByteArray &ba) - \overload - - Appends the byte array \a ba to the stream, creating a CBOR Byte String - value. QCborStreamWriter will attempt to write the entire string in one - chunk. - - The following example will load and append the contents of a file to the - stream: - - \snippet code/src_corelib_serialization_qcborstream.cpp 7 - - As the example shows, unlike JSON, CBOR requires no escaping for binary - content. - - \sa appendByteString(), QCborStreamReader::isByteArray(), - QCborStreamReader::readByteArray() - */ - -/*! - \overload - - Appends the text string \a str to the stream, creating a CBOR Text String - value. QCborStreamWriter will attempt to write the entire string in one - chunk. - - The following example appends a simple string to the stream: - - \snippet code/src_corelib_serialization_qcborstream.cpp 8 - - \b{Performance note}: CBOR requires that all Text Strings be encoded in - UTF-8, so this function will iterate over the characters in the string to - determine whether the contents are US-ASCII or not. If the string is found - to contain characters outside of US-ASCII, it will allocate memory and - convert to UTF-8. If this check is unnecessary, use appendTextString() - instead. - - \sa QCborStreamReader::isString(), QCborStreamReader::readString() - */ -void QCborStreamWriter::append(QLatin1String str) -{ - // We've got Latin-1 but CBOR wants UTF-8, so check if the string is the - // common subset (US-ASCII). - if (QtPrivate::isAscii(str)) { - // it is plain US-ASCII - appendTextString(str.latin1(), str.size()); - } else { - // non-ASCII, so we need a pass-through UTF-16 - append(QString(str)); - } -} - -/*! - \overload - - Appends the text string \a str to the stream, creating a CBOR Text String - value. QCborStreamWriter will attempt to write the entire string in one - chunk. - - The following example writes an arbitrary QString to the stream: - - \snippet code/src_corelib_serialization_qcborstream.cpp 9 - - \sa QCborStreamReader::isString(), QCborStreamReader::readString() - */ -void QCborStreamWriter::append(QStringView str) -{ - QByteArray utf8 = str.toUtf8(); - appendTextString(utf8.constData(), utf8.size()); -} - -/*! - \overload - - Appends the CBOR tag \a tag to the stream, creating a CBOR Tag value. All - tags must be followed by another type which they provide meaning for. - - In the following example, we append a CBOR Tag 36 (Regular Expression) and a - QRegularExpression's pattern to the stream: - - \snippet code/src_corelib_serialization_qcborstream.cpp 10 - - \sa QCborStreamReader::isTag(), QCborStreamReader::toTag() - */ -void QCborStreamWriter::append(QCborTag tag) -{ - d->executeAppend(cbor_encode_tag, CborTag(tag)); -} - -/*! - \fn void QCborStreamWriter::append(QCborKnownTags tag) - \overload - - Appends the CBOR tag \a tag to the stream, creating a CBOR Tag value. All - tags must be followed by another type which they provide meaning for. - - In the following example, we append a CBOR Tag 1 (Unix \c time_t) and an - integer representing the current time to the stream, obtained using the \c - time() function: - - \snippet code/src_corelib_serialization_qcborstream.cpp 11 - - \sa QCborStreamReader::isTag(), QCborStreamReader::toTag() - */ - -/*! - \overload - - Appends the CBOR simple type \a st to the stream, creating a CBOR Simple - Type value. In the following example, we write the simple type for Null as - well as for type 32, which Qt has no support for. - - \snippet code/src_corelib_serialization_qcborstream.cpp 12 - - \note Using Simple Types for which there is no specification can lead to - validation errors by the remote receiver. In addition, simple type values 24 - through 31 (inclusive) are reserved and must not be used. - - \sa QCborStreamReader::isSimpleType(), QCborStreamReader::toSimpleType() - */ -void QCborStreamWriter::append(QCborSimpleType st) -{ - d->executeAppend(cbor_encode_simple_value, uint8_t(st)); -} - -/*! - \overload - - Appends the floating point number \a f to the stream, creating a CBOR 16-bit - Half-Precision Floating Point value. The following code can be used to convert - a C++ \tt float to \c qfloat16 if there's no loss of precision and append it, or - instead append the \tt float. - - \snippet code/src_corelib_serialization_qcborstream.cpp 13 - - \sa QCborStreamReader::isFloat16(), QCborStreamReader::toFloat16() - */ -void QCborStreamWriter::append(qfloat16 f) -{ - d->executeAppend(cbor_encode_half_float, static_cast(&f)); -} - -/*! - \overload - - Appends the floating point number \a f to the stream, creating a CBOR 32-bit - Single-Precision Floating Point value. The following code can be used to convert - a C++ \tt double to \tt float if there's no loss of precision and append it, or - instead append the \tt double. - - \snippet code/src_corelib_serialization_qcborstream.cpp 14 - - \sa QCborStreamReader::isFloat(), QCborStreamReader::toFloat() - */ -void QCborStreamWriter::append(float f) -{ - d->executeAppend(cbor_encode_float, f); -} - -/*! - \overload - - Appends the floating point number \a d to the stream, creating a CBOR 64-bit - Double-Precision Floating Point value. QCborStreamWriter always appends the - number as-is, performing no check for whether the number is the canonical - form for NaN, an infinite, whether it is denormal or if it could be written - with a shorter format. - - The following code performs all those checks, except for the denormal one, - which is expected to be taken into account by the system FPU or floating - point emulation directly. - - \snippet code/src_corelib_serialization_qcborstream.cpp 15 - - Determining if a double can be converted to an integral with no loss of - precision is left as an exercise to the reader. - - \sa QCborStreamReader::isDouble(), QCborStreamReader::toDouble() - */ -void QCborStreamWriter::append(double d) -{ - this->d->executeAppend(cbor_encode_double, d); -} - -/*! - Appends \a len bytes of data starting from \a data to the stream, creating a - CBOR Byte String value. QCborStreamWriter will attempt to write the entire - string in one chunk. - - Unlike the QByteArray overload of append(), this function is not limited by - QByteArray's size limits. However, note that neither - QCborStreamReader::readByteArray() nor QCborValue support reading CBOR - streams with byte arrays larger than 2 GB. - - \sa append(), appendTextString(), - QCborStreamReader::isByteArray(), QCborStreamReader::readByteArray() - */ -void QCborStreamWriter::appendByteString(const char *data, qsizetype len) -{ - d->executeAppend(cbor_encode_byte_string, reinterpret_cast(data), size_t(len)); -} - -/*! - Appends \a len bytes of text starting from \a utf8 to the stream, creating a - CBOR Text String value. QCborStreamWriter will attempt to write the entire - string in one chunk. - - The string pointed to by \a utf8 is expected to be properly encoded UTF-8. - QCborStreamWriter performs no validation that this is the case. - - Unlike the QLatin1String overload of append(), this function is not limited - to 2 GB. However, note that neither QCborStreamReader::readString() nor - QCborValue support reading CBOR streams with text strings larger than 2 GB. - - \sa append(QLatin1String), append(QStringView), - QCborStreamReader::isString(), QCborStreamReader::readString() - */ -void QCborStreamWriter::appendTextString(const char *utf8, qsizetype len) -{ - d->executeAppend(cbor_encode_text_string, utf8, size_t(len)); -} - -/*! - \fn void QCborStreamWriter::append(const char *str, qsizetype size) - \overload - - Appends \a size bytes of text starting from \a str to the stream, creating a - CBOR Text String value. QCborStreamWriter will attempt to write the entire - string in one chunk. If \a size is -1, this function will write \c strlen(\a - str) bytes. - - The string pointed to by \a str is expected to be properly encoded UTF-8. - QCborStreamWriter performs no validation that this is the case. - - Unlike the QLatin1String overload of append(), this function is not limited - to 2 GB. However, note that neither QCborStreamReader nor QCborValue support - reading CBOR streams with text strings larger than 2 GB. - - \sa append(QLatin1String), append(QStringView), - QCborStreamReader::isString(), QCborStreamReader::readString() - */ - -/*! - \fn void QCborStreamWriter::append(bool b) - \overload - - Appends the boolean value \a b to the stream, creating either a CBOR False - value or a CBOR True value. This function is equivalent to (and implemented - as): - - \snippet code/src_corelib_serialization_qcborstream.cpp 16 - - \sa appendNull(), appendUndefined(), - QCborStreamReader::isBool(), QCborStreamReader::toBool() - */ - -/*! - \fn void QCborStreamWriter::append(std::nullptr_t) - \overload - - Appends a CBOR Null value to the stream. This function is equivalent to (and - implemented as): The parameter is ignored. - - \snippet code/src_corelib_serialization_qcborstream.cpp 17 - - \sa appendNull(), append(QCborSimpleType), QCborStreamReader::isNull() - */ - -/*! - \fn void QCborStreamWriter::appendNull() - - Appends a CBOR Null value to the stream. This function is equivalent to (and - implemented as): - - \snippet code/src_corelib_serialization_qcborstream.cpp 18 - - \sa append(std::nullptr_t), append(QCborSimpleType), QCborStreamReader::isNull() - */ - -/*! - \fn void QCborStreamWriter::appendUndefined() - - Appends a CBOR Undefined value to the stream. This function is equivalent to (and - implemented as): - - \snippet code/src_corelib_serialization_qcborstream.cpp 19 - - \sa append(QCborSimpleType), QCborStreamReader::isUndefined() - */ - -/*! - Starts a CBOR Array with indeterminate length in the CBOR stream. Each - startArray() call must be paired with one endArray() call and the current - CBOR element extends until the end of the array. - - The array created by this function has no explicit length. Instead, its - length is implied by the elements contained in it. Note, however, that use - of indeterminate-length arrays is not compliant with canonical CBOR encoding. - - The following example appends elements from the linked list of strings - passed as input: - - \snippet code/src_corelib_serialization_qcborstream.cpp 20 - - \sa startArray(quint64), endArray(), startMap(), QCborStreamReader::isArray(), - QCborStreamReader::isLengthKnown() - */ -void QCborStreamWriter::startArray() -{ - d->createContainer(cbor_encoder_create_array); -} - -/*! - \overload - - Starts a CBOR Array with explicit length of \a count items in the CBOR - stream. Each startArray call must be paired with one endArray() call and the - current CBOR element extends until the end of the array. - - The array created by this function has an explicit length and therefore - exactly \a count items must be added to the CBOR stream. Adding fewer or - more items will result in failure during endArray() and the CBOR stream will - be corrupt. However, explicit-length arrays are required by canonical CBOR - encoding. - - The following example appends all strings found in the \l QStringList passed as input: - - \snippet code/src_corelib_serialization_qcborstream.cpp 21 - - \b{Size limitations}: The parameter to this function is quint64, which would - seem to allow up to 2\sup{64}-1 elements in the array. However, both - QCborStreamWriter and QCborStreamReader are currently limited to 2\sup{32}-2 - items on 32-bit systems and 2\sup{64}-2 items on 64-bit ones. Also note that - QCborArray is currently limited to 2\sup{27} elements in any platform. - - \sa startArray(), endArray(), startMap(), QCborStreamReader::isArray(), - QCborStreamReader::isLengthKnown() - */ -void QCborStreamWriter::startArray(quint64 count) -{ - d->createContainer(cbor_encoder_create_array, count); -} - -/*! - Terminates the array started by either overload of startArray() and returns - true if the correct number of elements was added to the array. This function - must be called for every startArray() used. - - A return of false indicates error in the application and an unrecoverable - error in this stream. QCborStreamWriter also writes a warning using - qWarning() if that happens. - - Calling this function when the current container is not an array is also an - error, though QCborStreamWriter cannot currently detect this condition. - - \sa startArray(), startArray(quint64), endMap() - */ -bool QCborStreamWriter::endArray() -{ - return d->closeContainer(); -} - -/*! - Starts a CBOR Map with indeterminate length in the CBOR stream. Each - startMap() call must be paired with one endMap() call and the current CBOR - element extends until the end of the map. - - The map created by this function has no explicit length. Instead, its length - is implied by the elements contained in it. Note, however, that use of - indeterminate-length maps is not compliant with canonical CBOR encoding - (canonical encoding also requires keys to be unique and in sorted order). - - The following example appends elements from the linked list of int and - string pairs passed as input: - - \snippet code/src_corelib_serialization_qcborstream.cpp 22 - - \sa startMap(quint64), endMap(), startArray(), QCborStreamReader::isMap(), - QCborStreamReader::isLengthKnown() - */ -void QCborStreamWriter::startMap() -{ - d->createContainer(cbor_encoder_create_map); -} - -/*! - \overload - - Starts a CBOR Map with explicit length of \a count items in the CBOR - stream. Each startMap call must be paired with one endMap() call and the - current CBOR element extends until the end of the map. - - The map created by this function has an explicit length and therefore - exactly \a count pairs of items must be added to the CBOR stream. Adding - fewer or more items will result in failure during endMap() and the CBOR - stream will be corrupt. However, explicit-length map are required by - canonical CBOR encoding. - - The following example appends all strings found in the \l QMap passed as input: - - \snippet code/src_corelib_serialization_qcborstream.cpp 23 - - \b{Size limitations}: The parameter to this function is quint64, which would - seem to allow up to 2\sup{64}-1 pairs in the map. However, both - QCborStreamWriter and QCborStreamReader are currently limited to 2\sup{31}-1 - items on 32-bit systems and 2\sup{63}-1 items on 64-bit ones. Also note that - QCborMap is currently limited to 2\sup{26} elements in any platform. - - \sa startMap(), endMap(), startArray(), QCborStreamReader::isMap(), - QCborStreamReader::isLengthKnown() - */ -void QCborStreamWriter::startMap(quint64 count) -{ - d->createContainer(cbor_encoder_create_map, count); -} - -/*! - Terminates the map started by either overload of startMap() and returns - true if the correct number of elements was added to the array. This function - must be called for every startMap() used. - - A return of false indicates error in the application and an unrecoverable - error in this stream. QCborStreamWriter also writes a warning using - qWarning() if that happens. - - Calling this function when the current container is not a map is also an - error, though QCborStreamWriter cannot currently detect this condition. - - \sa startMap(), startMap(quint64), endArray() - */ -bool QCborStreamWriter::endMap() -{ - return d->closeContainer(); -} - -/*! - \class QCborStreamReader - \inmodule QtCore - \ingroup cbor - \reentrant - \since 5.12 - - \brief The QCborStreamReader class is a simple CBOR stream decoder, operating - on either a QByteArray or QIODevice. - - This class can be used to decode a stream of CBOR content directly from - either a QByteArray or a QIODevice. CBOR is the Concise Binary Object - Representation, a very compact form of binary data encoding that is - compatible with JSON. It was created by the IETF Constrained RESTful - Environments (CoRE) WG, which has used it in many new RFCs. It is meant to - be used alongside the \l{https://tools.ietf.org/html/rfc7252}{CoAP - protocol}. - - QCborStreamReader provides a StAX-like API, similar to that of - \l{QXmlStreamReader}. Using it requires a bit of knowledge of CBOR encoding. - For a simpler API, see \l{QCborValue} and especially the decoding function - QCborValue::fromCbor(). - - Typically, one creates a QCborStreamReader by passing the source QByteArray - or QIODevice as a parameter to the constructor, then pop elements off the - stream if there were no errors in decoding. There are three kinds of CBOR - types: - - \table - \header \li Kind \li Types \li Behavior - \row \li Fixed-width \li Integers, Tags, Simple types, Floating point - \li Value is pre-parsed by QCborStreamReader, so accessor functions - are \c const. Must call next() to advance. - \row \li Strings \li Byte arrays, Text strings - \li Length (if known) is pre-parsed, but the string itself is not. - The accessor functions are not const and may allocate memory. - Once called, the accessor functions automatically advance to - the next element. - \row \li Containers \li Arrays, Maps - \li Length (if known) is pre-parsed. To access the elements, you - must call enterContainer(), read all elements, then call - leaveContainer(). That function advances to the next element. - \endtable - - So a processor function typically looks like this: - - \snippet code/src_corelib_serialization_qcborstream.cpp 24 - - \section1 CBOR support - - The following table lists the CBOR features that QCborStreamReader supports. - - \table - \header \li Feature \li Support - \row \li Unsigned numbers \li Yes (full range) - \row \li Negative numbers \li Yes (full range) - \row \li Byte strings \li Yes - \row \li Text strings \li Yes - \row \li Chunked strings \li Yes - \row \li Tags \li Yes (arbitrary) - \row \li Booleans \li Yes - \row \li Null \li Yes - \row \li Undefined \li Yes - \row \li Arbitrary simple values \li Yes - \row \li Half-precision float (16-bit) \li Yes - \row \li Single-precision float (32-bit) \li Yes - \row \li Double-precision float (64-bit) \li Yes - \row \li Infinities and NaN floating point \li Yes - \row \li Determinate-length arrays and maps \li Yes - \row \li Indeterminate-length arrays and maps \li Yes - \row \li Map key types other than strings and integers \li Yes (arbitrary) - \endtable - - \section1 Dealing with invalid or incomplete CBOR streams - - QCborStreamReader is capable of detecting corrupt input on its own. The - library it uses has been extensively tested against invalid input of any - kind and is quite able to report errors. If any is detected, - QCborStreamReader will set lastError() to a value besides - QCborError::NoError, indicating which situation was detected. - - Most errors detected by QCborStreamReader during normal item parsing are not - recoverable. The code using QCborStreamReader may opt to handle the data - that was properly decoded or it can opt to discard the entire data. - - The only recoverable error is QCborError::EndOfFile, which indicates that - more data is required in order to complete the parsing. This situation is - useful when data is being read from an asynchronous source, such as a pipe - (QProcess) or a socket (QTcpSocket, QUdpSocket, QNetworkReply, etc.). When - more data arrives, the surrounding code needs to call either addData(), if - parsing from a QByteArray, or reparse(), if it is instead reading directly - a the QIDOevice that now has more data available (see setDevice()). - - \sa QCborStreamWriter, QCborValue, QXmlStreamReader - */ - -/*! - \enum QCborStreamReader::Type - - This enumeration contains all possible CBOR types as decoded by - QCborStreamReader. CBOR has 7 major types, plus a number of simple types - carrying no value, and floating point values. - - \value UnsignedInteger (Major type 0) Ranges from 0 to 2\sup{64} - 1 - (18,446,744,073,709,551,616) - \value NegativeInteger (Major type 1) Ranges from -1 to -2\sup{64} - (-18,446,744,073,709,551,616) - \value ByteArray (Major type 2) Arbitrary binary data. - \value ByteString An alias to ByteArray. - \value String (Major type 3) Unicode text, possibly containing NULs. - \value TextString An alias to String - \value Array (Major type 4) Array of heterogeneous items. - \value Map (Major type 5) Map/dictionary of heterogeneous items. - \value Tag (Major type 6) Numbers giving further semantic value - to generic CBOR items. See \l QCborTag for more information. - \value SimpleType (Major type 7) Types carrying no further value. Includes - booleans (true and false), null, undefined. - \value Float16 IEEE 754 half-precision floating point (\c qfloat16). - \value HalfFloat An alias to Float16. - \value Float IEEE 754 single-precision floating point (\tt float). - \value Double IEEE 754 double-precision floating point (\tt double). - \value Invalid Not a valid type, either due to parsing error or due to - reaching the end of an array or map. - */ - -/*! - \enum QCborStreamReader::StringResultCode - - This enum is returned by readString() and readByteArray() and is used to - indicate what the status of the parsing is. - - \value EndOfString The parsing for the string is complete, with no error. - \value Ok The function returned data; there was no error. - \value Error Parsing failed with an error. - */ - -/*! - \class QCborStreamReader::StringResult - \inmodule QtCore - - This class is returned by readString() and readByteArray(), with either the - contents of the string that was read or an indication that the parsing is - done or found an error. - - The contents of \l data are valid only if \l status is - \l{StringResultCode}{Ok}. Otherwise, it should be null. - */ - -/*! - \variable QCborStreamReader::StringResult::data - - Contains the actual data from the string if \l status is \c Ok. - */ - -/*! - \variable QCborStreamReader::StringResult::status - - Contains the status of the attempt of reading the string from the stream. - */ - -/*! - \fn QCborStreamReader::Type QCborStreamReader::type() const - - Returns the type of the current element. It is one of the valid types or - Invalid. - - \sa isValid(), isUnsignedInteger(), isNegativeInteger(), isInteger(), - isByteArray(), isString(), isArray(), isMap(), isTag(), isSimpleType(), - isBool(), isFalse(), isTrue(), isNull(), isUndefined(), isFloat16(), - isFloat(), isDouble() - */ - -/*! - \fn bool QCborStreamReader::isValid() const - - Returns true if the current element is valid, false otherwise. The current - element may be invalid if there was a decoding error or we've just parsed - the last element in an array or map. - - \note This function is not the opposite of isNull(). Null is a normal CBOR - type that must be handled by the application. - - \sa type(), isInvalid() - */ - -/*! - \fn bool QCborStreamReader::isInvalid() const - - Returns true if the current element is invalid, false otherwise. The current - element may be invalid if there was a decoding error or we've just parsed - the last element in an array or map. - - \note This function is not to be confused with isNull(). Null is a normal - CBOR type that must be handled by the application. - - \sa type(), isValid() - */ - -/*! - \fn bool QCborStreamReader::isUnsignedInteger() const - - Returns true if the type of the current element is an unsigned integer (that - is if type() returns QCborStreamReader::UnsignedInteger). If this function - returns true, you may call toUnsignedInteger() or toInteger() to read that value. - - \sa type(), toUnsignedInteger(), toInteger(), isInteger(), isNegativeInteger() - */ - -/*! - \fn bool QCborStreamReader::isNegativeInteger() const - - Returns true if the type of the current element is a negative integer (that - is if type() returns QCborStreamReader::NegativeInteger). If this function - returns true, you may call toNegativeInteger() or toInteger() to read that value. - - \sa type(), toNegativeInteger(), toInteger(), isInteger(), isUnsignedInteger() - */ - -/*! - \fn bool QCborStreamReader::isInteger() const - - Returns true if the type of the current element is either an unsigned - integer or a negative one (that is, if type() returns - QCborStreamReader::UnsignedInteger or QCborStreamReader::NegativeInteger). - If this function returns true, you may call toInteger() to read that - value. - - \sa type(), toInteger(), toUnsignedInteger(), toNegativeInteger(), - isUnsignedInteger(), isNegativeInteger() - */ - -/*! - \fn bool QCborStreamReader::isByteArray() const - - Returns true if the type of the current element is a byte array (that is, - if type() returns QCborStreamReader::ByteArray). If this function returns - true, you may call readByteArray() to read that data. - - \sa type(), readByteArray(), isString() - */ - -/*! - \fn bool QCborStreamReader::isString() const - - Returns true if the type of the current element is a text string (that is, - if type() returns QCborStreamReader::String). If this function returns - true, you may call readString() to read that data. - - \sa type(), readString(), isByteArray() - */ - -/*! - \fn bool QCborStreamReader::isArray() const - - Returns true if the type of the current element is an array (that is, - if type() returns QCborStreamReader::Array). If this function returns - true, you may call enterContainer() to begin parsing that container. - - When the current element is an array, you may also call isLengthKnown() to - find out if the array's size is explicit in the CBOR stream. If it is, that - size can be obtained by calling length(). - - The following example pre-allocates a QVariantList given the array's size - for more efficient decoding: - - \snippet code/src_corelib_serialization_qcborstream.cpp 25 - - \note The code above does not validate that the length is a sensible value. - If the input stream reports that the length is 1 billion elements, the above - function will try to allocate some 16 GB or more of RAM, which can lead to a - crash. - - \sa type(), isMap(), isLengthKnown(), length(), enterContainer(), leaveContainer() - */ - -/*! - \fn bool QCborStreamReader::isMap() const - - Returns true if the type of the current element is a map (that is, if type() - returns QCborStreamReader::Map). If this function returns true, you may call - enterContainer() to begin parsing that container. - - When the current element is a map, you may also call isLengthKnown() to - find out if the map's size is explicit in the CBOR stream. If it is, that - size can be obtained by calling length(). - - The following example pre-allocates a QVariantMap given the map's size - for more efficient decoding: - - \snippet code/src_corelib_serialization_qcborstream.cpp 26 - - The example above uses a function called \c readElementAsString to read the - map's keys and obtain a string. That is because CBOR maps may contain any - type as keys, not just strings. User code needs to either perform this - conversion, reject non-string keys, or instead use a different container - besides \l QVariantMap and \l QVariantHash. For example, if the map is - expected to contain integer keys, which is recommended as it reduces stream - size and parsing, the correct container would be \c{\l{QMap}} - or \c{\l{QHash}}. - - \note The code above does not validate that the length is a sensible value. - If the input stream reports that the length is 1 billion elements, the above - function will try to allocate some 24 GB or more of RAM, which can lead to a - crash. - - \sa type(), isArray(), isLengthKnown(), length(), enterContainer(), leaveContainer() - */ - -/*! - \fn bool QCborStreamReader::isTag() const - - Returns true if the type of the current element is a CBOR tag (that is, - if type() returns QCborStreamReader::Tag). If this function returns - true, you may call toTag() to read that data. - - \sa type(), toTag() - */ - -/*! - \fn bool QCborStreamReader::isFloat16() const - - Returns true if the type of the current element is an IEEE 754 - half-precision floating point (that is, if type() returns - QCborStreamReader::Float16). If this function returns true, you may call - toFloat16() to read that data. - - \sa type(), toFloat16(), isFloat(), isDouble() - */ - -/*! - \fn bool QCborStreamReader::isFloat() const - - Returns true if the type of the current element is an IEEE 754 - single-precision floating point (that is, if type() returns - QCborStreamReader::Float). If this function returns true, you may call - toFloat() to read that data. - - \sa type(), toFloat(), isFloat16(), isDouble() - */ - -/*! - \fn bool QCborStreamReader::isDouble() const - - Returns true if the type of the current element is an IEEE 754 - double-precision floating point (that is, if type() returns - QCborStreamReader::Double). If this function returns true, you may call - toDouble() to read that data. - - \sa type(), toDouble(), isFloat16(), isFloat() - */ - -/*! - \fn bool QCborStreamReader::isSimpleType() const - - Returns true if the type of the current element is any CBOR simple type, - including a boolean value (true and false) as well as null and undefined. To - find out which simple type this is, call toSimpleType(). Alternatively, to - test for one specific simple type, call the overload that takes a - QCborSimpleType parameter. - - CBOR simple types are types that do not carry extra value. There are 255 - possibilities, but there are currently only four values that have defined - meaning. Code is not expected to cope with unknown simple types and may - simply discard the stream as invalid if it finds an unknown one. - - \sa QCborSimpleType, type(), isSimpleType(QCborSimpleType), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isSimpleType(QCborSimpleType st) const - - Returns true if the type of the current element is the simple type \a st, - false otherwise. If this function returns true, then toSimpleType() will - return \a st. - - CBOR simple types are types that do not carry extra value. There are 255 - possibilities, but there are currently only four values that have defined - meaning. Code is not expected to cope with unknown simple types and may - simply discard the stream as invalid if it finds an unknown one. - - \sa QCborSimpleType, type(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isFalse() const - - Returns true if the current element is the \c false value, false if it is - anything else. - - \sa type(), isTrue(), isBool(), toBool(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isTrue() const - - Returns true if the current element is the \c true value, false if it is - anything else. - - \sa type(), isFalse(), isBool(), toBool(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isBool() const - - Returns true if the current element is a boolean value (\c true or \c - false), false if it is anything else. If this function returns true, you may - call toBool() to retrieve the value of the boolean. You may also call - toSimpleType() and compare to either QCborSimpleValue::True or - QCborSimpleValue::False. - - \sa type(), isFalse(), isTrue(), toBool(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isNull() const - - Returns true if the current element is the \c null value, false if it is - anything else. Null values may be used to indicate the absence of some - optional data. - - \note This function is not the opposite of isValid(). A Null value is a - valid CBOR value. - - \sa type(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isUndefined() const - - Returns true if the current element is the \c undefined value, false if it - is anything else. Undefined values may be encoded to indicate that some - conversion failed or was not possible when creating the stream. - QCborStreamReader never performs any replacement and this function will only - return true if the stream contains an explicit undefined value. - - \sa type(), isSimpleType(), toSimpleType() - */ - -/*! - \fn bool QCborStreamReader::isContainer() const - - Returns true if the current element is a container (that is, an array or a - map), false if it is anything else. If the current element is a container, - the isLengthKnown() function may be used to find out if the container's size - is explicit in the stream and, if so, length() can be used to get that size. - - More importantly, for a container, the enterContainer() function is - available to begin iterating through the elements contained therein. - - \sa type(), isArray(), isMap(), isLengthKnown(), length(), enterContainer(), - leaveContainer(), containerDepth() - */ - -class QCborStreamReaderPrivate -{ -public: - enum { - // 9 bytes is the maximum size for any integer, floating point or - // length in CBOR. - MaxCborIndividualSize = 9, - IdealIoBufferSize = 256 - }; - - QIODevice *device; - QByteArray buffer; - QStack containerStack; - - CborParser parser; - CborValue currentElement; - QCborError lastError = {}; - - QByteArray::size_type bufferStart; - bool corrupt = false; - - QCborStreamReaderPrivate(const QByteArray &data) - : device(nullptr), buffer(data) - { - initDecoder(); - } - - QCborStreamReaderPrivate(QIODevice *device) - { - setDevice(device); - } - - ~QCborStreamReaderPrivate() - { - } - - void setDevice(QIODevice *dev) - { - buffer.clear(); - device = dev; - initDecoder(); - } - - void initDecoder() - { - containerStack.clear(); - bufferStart = 0; - if (device) { - buffer.clear(); - buffer.reserve(IdealIoBufferSize); // sets the CapacityReserved flag - } - - preread(); - if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this)) - handleError(err); - else - lastError = { QCborError::NoError }; - } - - char *bufferPtr() - { - Q_ASSERT(buffer.isDetached()); - return const_cast(buffer.constData()) + bufferStart; - } - - void preread() - { - if (device && buffer.size() - bufferStart < MaxCborIndividualSize) { - // load more, but only if there's more to be read - qint64 avail = device->bytesAvailable(); - Q_ASSERT(avail >= buffer.size()); - if (avail == buffer.size()) - return; - - if (bufferStart) - device->skip(bufferStart); // skip what we've already parsed - - if (buffer.size() != IdealIoBufferSize) - buffer.resize(IdealIoBufferSize); - - bufferStart = 0; - qint64 read = device->peek(bufferPtr(), IdealIoBufferSize); - if (read < 0) - buffer.clear(); - else if (read != IdealIoBufferSize) - buffer.truncate(read); - } - } - - void handleError(CborError err) noexcept - { - Q_ASSERT(err); - - // is the error fatal? - if (err != CborErrorUnexpectedEOF) - corrupt = true; - - lastError = fromCborError(err); - } - - void updateBufferAfterString(qsizetype offset, qsizetype size) - { - Q_ASSERT(device); - - bufferStart += offset; - qsizetype newStart = bufferStart + size; - qsizetype remainingInBuffer = buffer.size() - newStart; - - if (remainingInBuffer <= 0) { - // We've read from the QIODevice more than what was in the buffer. - buffer.truncate(0); - } else { - // There's still data buffered, but we need to move it around. - char *ptr = buffer.data(); - memmove(ptr, ptr + newStart, remainingInBuffer); - buffer.truncate(remainingInBuffer); - } - - bufferStart = 0; - } - - bool ensureStringIteration(); -}; - -void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error) -{ - d->handleError(CborError(error.c)); -} - -static inline bool qt_cbor_decoder_can_read(void *token, size_t len) -{ - Q_ASSERT(len <= QCborStreamReaderPrivate::MaxCborIndividualSize); - auto self = static_cast(token); - - qint64 avail = self->buffer.size() - self->bufferStart; - return len <= quint64(avail); -} - -static void qt_cbor_decoder_advance(void *token, size_t len) -{ - Q_ASSERT(len <= QCborStreamReaderPrivate::MaxCborIndividualSize); - auto self = static_cast(token); - Q_ASSERT(len <= size_t(self->buffer.size() - self->bufferStart)); - - self->bufferStart += int(len); - self->preread(); -} - -static void *qt_cbor_decoder_read(void *token, void *userptr, size_t offset, size_t len) -{ - Q_ASSERT(len == 1 || len == 2 || len == 4 || len == 8); - Q_ASSERT(offset == 0 || offset == 1); - auto self = static_cast(token); - - // we must have pre-read the data - Q_ASSERT(len + offset <= size_t(self->buffer.size() - self->bufferStart)); - return memcpy(userptr, self->buffer.constData() + self->bufferStart + offset, len); -} - -static CborError qt_cbor_decoder_transfer_string(void *token, const void **userptr, size_t offset, size_t len) -{ - auto self = static_cast(token); - Q_ASSERT(offset <= size_t(self->buffer.size())); - Q_STATIC_ASSERT(sizeof(size_t) >= sizeof(QByteArray::size_type)); - Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); - - // check that we will have enough data from the QIODevice before we advance - // (otherwise, we'd lose the length information) - qsizetype total; - if (len > size_t(std::numeric_limits::max()) - || add_overflow(offset, len, &total)) - return CborErrorDataTooLarge; - - // our string transfer is just saving the offset to the userptr - *userptr = reinterpret_cast(offset); - - qint64 avail = (self->device ? self->device->bytesAvailable() : self->buffer.size()) - - self->bufferStart; - return total > avail ? CborErrorUnexpectedEOF : CborNoError; -} - -bool QCborStreamReaderPrivate::ensureStringIteration() -{ - if (currentElement.flags & CborIteratorFlag_IteratingStringChunks) - return true; - - CborError err = cbor_value_begin_string_iteration(¤tElement); - if (!err) - return true; - handleError(err); - return false; -} - -/*! - \internal - */ -inline void QCborStreamReader::preparse() -{ - if (lastError() == QCborError::NoError) { - type_ = cbor_value_get_type(&d->currentElement); - - if (type_ == CborInvalidType) { - // We may have reached the end. - if (d->device && d->containerStack.isEmpty()) { - d->buffer.clear(); - if (d->bufferStart) - d->device->skip(d->bufferStart); - d->bufferStart = 0; - } - } else { - d->lastError = {}; - // Undo the type mapping that TinyCBOR does (we have an explicit type - // for negative integer and we don't have separate types for Boolean, - // Null and Undefined). - if (type_ == CborBooleanType || type_ == CborNullType || type_ == CborUndefinedType) { - type_ = CborSimpleType; - value64 = quint8(d->buffer.at(d->bufferStart)) - CborSimpleType; - } else { - // Using internal TinyCBOR API! - value64 = _cbor_value_extract_int64_helper(&d->currentElement); - - if (cbor_value_is_negative_integer(&d->currentElement)) - type_ = quint8(QCborStreamReader::NegativeInteger); - } - } - } else { - type_ = Invalid; - } -} - -/*! - Creates a QCborStreamReader object with no source data. After construction, - QCborStreamReader will report an error parsing. - - You can add more data by calling addData() or by setting a different source - device using setDevice(). - - \sa addData(), isValid() - */ -QCborStreamReader::QCborStreamReader() - : QCborStreamReader(QByteArray()) -{ -} - -/*! - \overload - - Creates a QCborStreamReader object with \a len bytes of data starting at \a - data. The pointer must remain valid until QCborStreamReader is destroyed. - */ -QCborStreamReader::QCborStreamReader(const char *data, qsizetype len) - : QCborStreamReader(QByteArray::fromRawData(data, len)) -{ -} - -/*! - \overload - - Creates a QCborStreamReader object with \a len bytes of data starting at \a - data. The pointer must remain valid until QCborStreamReader is destroyed. - */ -QCborStreamReader::QCborStreamReader(const quint8 *data, qsizetype len) - : QCborStreamReader(QByteArray::fromRawData(reinterpret_cast(data), len)) -{ -} - -/*! - \overload - - Creates a QCborStreamReader object that will parse the CBOR stream found in - \a data. - */ -QCborStreamReader::QCborStreamReader(const QByteArray &data) - : d(new QCborStreamReaderPrivate(data)) -{ - preparse(); -} - -/*! - \overload - - Creates a QCborStreamReader object that will parse the CBOR stream found by - reading from \a device. QCborStreamReader does not take ownership of \a - device, so it must remain valid until this oject is destroyed. - */ -QCborStreamReader::QCborStreamReader(QIODevice *device) - : d(new QCborStreamReaderPrivate(device)) -{ - preparse(); -} - -/*! - Destroys this QCborStreamReader object and frees any associated resources. - */ -QCborStreamReader::~QCborStreamReader() -{ -} - -/*! - Sets the source of data to \a device, resetting the decoder to its initial - state. - */ -void QCborStreamReader::setDevice(QIODevice *device) -{ - d->setDevice(device); - preparse(); -} - -/*! - Returns the QIODevice that was set with either setDevice() or the - QCborStreamReader constructor. If this object was reading from a QByteArray, - this function returns nullptr instead. - */ -QIODevice *QCborStreamReader::device() const -{ - return d->device; -} - -/*! - Adds \a data to the CBOR stream and reparses the current element. This - function is useful if the end of the data was previously reached while - processing the stream, but now more data is available. - */ -void QCborStreamReader::addData(const QByteArray &data) -{ - addData(data.constData(), data.size()); -} - -/*! - \fn void QCborStreamReader::addData(const quint8 *data, qsizetype len) - \overload - - Adds \a len bytes of data starting at \a data to the CBOR stream and - reparses the current element. This function is useful if the end of the data - was previously reached while processing the stream, but now more data is - available. - */ - -/*! - \overload - - Adds \a len bytes of data starting at \a data to the CBOR stream and - reparses the current element. This function is useful if the end of the data - was previously reached while processing the stream, but now more data is - available. - */ -void QCborStreamReader::addData(const char *data, qsizetype len) -{ - if (!d->device) { - if (len > 0) - d->buffer.append(data, len); - reparse(); - } else { - qWarning("QCborStreamReader: addData() with device()"); - } -} - -/*! - Reparses the current element. This function must be called when more data - becomes available in the source QIODevice after parsing failed due to - reaching the end of the input data before the end of the CBOR stream. - - When reading from QByteArray(), the addData() function automatically calls - this function. Calling it when the reading had not failed is a no-op. - */ -void QCborStreamReader::reparse() -{ - d->lastError = {}; - d->preread(); - if (CborError err = cbor_value_reparse(&d->currentElement)) - d->handleError(err); - else - preparse(); -} - -/*! - Clears the decoder state and resets the input source data to an empty byte - array. After this function is called, QCborStreamReader will be indicating - an error parsing. - - Call addData() to add more data to be parsed. - - \sa reset(), setDevice() - */ -void QCborStreamReader::clear() -{ - setDevice(nullptr); -} - -/*! - Resets the source back to the beginning and clears the decoder state. If the - source data was a QByteArray, QCborStreamReader will restart from the - beginning of the array. - - If the source data is a QIODevice, this function will call - QIODevice::reset(), which will seek to byte position 0. If the CBOR stream - is not found at the beginning of the device (e.g., beginning of a file), - then this function will likely do the wrong thing. Instead, position the - QIODevice to the right offset and call setDevice(). - - \sa clear(), setDevice() - */ -void QCborStreamReader::reset() -{ - if (d->device) - d->device->reset(); - d->lastError = {}; - d->initDecoder(); - preparse(); -} - -/*! - Returns the last error in decoding the stream, if any. If no error - was encountered, this returns an QCborError::NoError. - - \sa isValid() - */ -QCborError QCborStreamReader::lastError() -{ - return d->lastError; -} - -/*! - Returns the offset in the input stream of the item currently being decoded. - The current offset is the number of decoded bytes so far only if the source - data is a QByteArray or it is a QIODevice that was positioned at its - beginning when decoding started. - - \sa reset(), clear(), device() - */ -qint64 QCborStreamReader::currentOffset() const -{ - return (d->device ? d->device->pos() : 0) + d->bufferStart; -} - -/*! - Returns the number of containers that this stream has entered with - enterContainer() but not yet left. - - \sa enterContainer(), leaveContainer() - */ -int QCborStreamReader::containerDepth() const -{ - return d->containerStack.size(); -} - -/*! - Returns either QCborStreamReader::Array or QCborStreamReader::Map, - indicating whether the container that contains the current item was an array - or map, respectively. If we're currently parsing the root element, this - function returns QCborStreamReader::Invalid. - - \sa containerDepth(), enterContainer() - */ -QCborStreamReader::Type QCborStreamReader::parentContainerType() const -{ - if (d->containerStack.isEmpty()) - return Invalid; - return Type(cbor_value_get_type(&qAsConst(d->containerStack).top())); -} - -/*! - Returns true if there are more items to be decoded in the current container - or false of we've reached its end. If we're parsing the root element, - hasNext() returning false indicates the parsing is complete; otherwise, if - the container depth is non-zero, then the outer code needs to call - leaveContainer(). - - \sa parentContainerType(), containerDepth(), leaveContainer() - */ -bool QCborStreamReader::hasNext() const noexcept -{ - return cbor_value_is_valid(&d->currentElement) && - !cbor_value_at_end(&d->currentElement); -} - -/*! - Advance the CBOR stream decoding one element. You should usually call this - function when parsing fixed-width basic elements (that is, integers, simple - values, tags and floating point values). But this function can be called - when the current item is a string, array or map too and it will skip over - that entire element, including all contained elements. - - This function returns true if advancing was successful, false otherwise. It - may fail if the stream is corrupt, incomplete or if the nesting level of - arrays and maps exceeds \a maxRecursion. Calling this function when - hasNext() has returned false is also an error. If this function returns - false, lastError() will return the error code detailing what the failure - was. - - \sa lastError(), isValid(), hasNext() - */ -bool QCborStreamReader::next(int maxRecursion) -{ - if (lastError() != QCborError::NoError) - return false; - - if (!hasNext()) { - d->handleError(CborErrorAdvancePastEOF); - } else if (maxRecursion < 0) { - d->handleError(CborErrorNestingTooDeep); - } else if (isContainer()) { - // iterate over each element - enterContainer(); - while (lastError() == QCborError::NoError && hasNext()) - next(maxRecursion - 1); - if (lastError() == QCborError::NoError) - leaveContainer(); - } else if (isString() || isByteArray()) { - auto r = _readByteArray_helper(); - while (r.status == Ok) { - if (isString() && !QUtf8::isValidUtf8(r.data, r.data.size()).isValidUtf8) { - d->handleError(CborErrorInvalidUtf8TextString); - break; - } - r = _readByteArray_helper(); - } - } else { - // fixed types - CborError err = cbor_value_advance_fixed(&d->currentElement); - if (err) - d->handleError(err); - } - - preparse(); - return d->lastError == QCborError::NoError; -} - -/*! - Returns true if the length of the current array, map, byte array or string - is known (explicit in the CBOR stream), false otherwise. This function - should only be called if the element is one of those. - - If the length is known, it may be obtained by calling length(). - - If the length of a map or an array is not known, it is implied by the number - of elements present in the stream. QCborStreamReader has no API to calculate - the length in that condition. - - Strings and byte arrays may also have indeterminate length (that is, they - may be transmitted in multiple chunks). Those cannot currently be created - with QCborStreamWriter, but they could be with other encoders, so - QCborStreamReader supports them. - - \sa length(), QCborStreamWriter::startArray(), QCborStreamWriter::startMap() - */ -bool QCborStreamReader::isLengthKnown() const noexcept -{ - return cbor_value_is_length_known(&d->currentElement); -} - -/*! - Returns the length of the string or byte array, or the number of items in an - array or the number, of item pairs in a map, if known. This function must - not be called if the length is unknown (that is, if isLengthKnown() returned - false). It is an error to do that and it will cause QCborStreamReader to - stop parsing the input stream. - - \sa isLengthKnown(), QCborStreamWriter::startArray(), QCborStreamWriter::startMap() - */ -quint64 QCborStreamReader::length() const -{ - CborError err; - switch (type()) { - case String: - case ByteArray: - case Map: - case Array: - if (isLengthKnown()) - return value64; - err = CborErrorUnknownLength; - break; - - default: - err = CborErrorIllegalType; - break; - } - - d->handleError(err); - return quint64(-1); -} - -/*! - \fn bool QCborStreamReader::enterContainer() - - Enters the array or map that is the current item and prepares for iterating - the elements contained in the container. Returns true if entering the - container succeeded, false otherwise (usually, a parsing error). Each call - to enterContainer() must be paired with a call to leaveContainer(). - - This function may only be called if the current item is an array or a map - (that is, if isArray(), isMap() or isContainer() is true). Calling it in any - other condition is an error. - - \sa leaveContainer(), isContainer(), isArray(), isMap() - */ -bool QCborStreamReader::_enterContainer_helper() -{ - d->containerStack.push(d->currentElement); - CborError err = cbor_value_enter_container(&d->containerStack.top(), &d->currentElement); - if (!err) { - preparse(); - return true; - } - d->handleError(err); - return false; -} - -/*! - Leaves the array or map whose items were being processed and positions the - decoder at the next item after the end of the container. Returns true if - leaving the container succeeded, false otherwise (usually, a parsing error). - Each call to enterContainer() must be paired with a call to - leaveContainer(). - - This function may only be called if hasNext() has returned false and - containerDepth() is not zero. Calling it in any other condition is an error. - - \sa enterContainer(), parentContainerType(), containerDepth() - */ -bool QCborStreamReader::leaveContainer() -{ - if (d->containerStack.isEmpty()) { - qWarning("QCborStreamReader::leaveContainer: trying to leave top-level element"); - return false; - } - if (d->corrupt) - return false; - - CborValue container = d->containerStack.pop(); - CborError err = cbor_value_leave_container(&container, &d->currentElement); - d->currentElement = container; - if (err) { - d->handleError(err); - return false; - } - - preparse(); - return true; -} - -/*! - \fn bool QCborStreamReader::toBool() const - - Returns the boolean value of the current element. - - This function does not perform any type conversions, including from integer. - Therefore, it may only be called if isTrue(), isFalse() or isBool() returned - true; calling it in any other condition is an error. - - \sa isBool(), isTrue(), isFalse(), toInteger() - */ - -/*! - \fn QCborTag QCborStreamReader::toTag() const - - Returns the tag value of the current element. - - This function does not perform any type conversions, including from integer. - Therefore, it may only be called if isTag() is true; calling it in any other - condition is an error. - - Tags are 64-bit numbers attached to generic CBOR types that give them - further meaning. For a list of known tags, see the \l QCborKnownTags - enumeration. - - \sa isTag(), toInteger(), QCborKnownTags - */ - -/*! - \fn quint64 QCborStreamReader::toUnsignedInteger() const - - Returns the unsigned integer value of the current element. - - This function does not perform any type conversions, including from boolean - or CBOR tag. Therefore, it may only be called if isUnsignedInteger() is - true; calling it in any other condition is an error. - - This function may be used to obtain numbers beyond the range of the return - type of toInteger(). - - \sa type(), toInteger(), isUnsignedInteger(), isNegativeInteger() - */ - -/*! - \fn QCborNegativeValue QCborStreamReader::toNegativeInteger() const - - Returns the negative integer value of the current element. - QCborNegativeValue is a 64-bit unsigned integer containing the absolute - value of the negative number that was stored in the CBOR stream. - Additionally, QCborNegativeValue(0) represents the number -2\sup{64}. - - This function does not perform any type conversions, including from boolean - or CBOR tag. Therefore, it may only be called if isNegativeInteger() is - true; calling it in any other condition is an error. - - This function may be used to obtain numbers beyond the range of the return - type of toInteger(). However, use of negative numbers smaller than -2\sup{63} - is extremely discouraged. - - \sa type(), toInteger(), isNegativeInteger(), isUnsignedInteger() - */ - -/*! - \fn qint64 QCborStreamReader::toInteger() const - - Returns the integer value of the current element, be it negative, positive - or zero. If the value is larger than 2\sup{63} - 1 or smaller than - -2\sup{63}, the returned value will overflow and will have an incorrect - sign. If handling those values is required, use toUnsignedInteger() or - toNegativeInteger() instead. - - This function does not perform any type conversions, including from boolean - or CBOR tag. Therefore, it may only be called if isInteger() is true; - calling it in any other condition is an error. - - \sa isInteger(), toUnsignedInteger(), toNegativeInteger() - */ - -/*! - \fn QCborSimpleType QCborStreamReader::toSimpleType() const - - Returns value of the current simple type. - - This function does not perform any type conversions, including from integer. - Therefore, it may only be called if isSimpleType() is true; calling it in - any other condition is an error. - - \sa isSimpleType(), isTrue(), isFalse(), isBool(), isNull(), isUndefined() - */ - -/*! - \fn qfloat16 QCborStreamReader::toFloat16() const - - Returns the 16-bit half-precision floating point value of the current element. - - This function does not perform any type conversions, including from other - floating point types or from integer values. Therefore, it may only be - called if isFloat16() is true; calling it in any other condition is an - error. - - \sa isFloat16(), toFloat(), toDouble() - */ - -/*! - \fn float QCborStreamReader::toFloat() const - - Returns the 32-bit single-precision floating point value of the current - element. - - This function does not perform any type conversions, including from other - floating point types or from integer values. Therefore, it may only be - called if isFloat() is true; calling it in any other condition is an error. - - \sa isFloat(), toFloat16(), toDouble() - */ - -/*! - \fn double QCborStreamReader::toDouble() const - - Returns the 64-bit double-precision floating point value of the current - element. - - This function does not perform any type conversions, including from other - floating point types or from integer values. Therefore, it may only be - called if isDouble() is true; calling it in any other condition is an error. - - \sa isDouble(), toFloat16(), toFloat() - */ - -/*! - \fn QCborStreamReader::StringResult QCborStreamReader::readString() - - Decodes one string chunk from the CBOR string and returns it. This function - is used for both regular and chunked string contents, so the caller must - always loop around calling this function, even if isLengthKnown() has - is true. The typical use of this function is as follows: - - \snippet code/src_corelib_serialization_qcborstream.cpp 27 - - This function does not perform any type conversions, including from integers - or from byte arrays. Therefore, it may only be called if isString() returned - true; calling it in any other condition is an error. - - \sa readByteArray(), isString(), readStringChunk() - */ -QCborStreamReader::StringResult QCborStreamReader::_readString_helper() -{ - auto r = _readByteArray_helper(); - QCborStreamReader::StringResult result; - result.status = r.status; - - if (r.status == Ok) { - QTextCodec::ConverterState cs; - result.data = QUtf8::convertToUnicode(r.data, r.data.size(), &cs); - if (cs.invalidChars == 0 && cs.remainingChars == 0) - return result; - - d->handleError(CborErrorInvalidUtf8TextString); - result.data.clear(); - result.status = Error; - return result; - } - return result; -} - -/*! - \fn QCborStreamReader::StringResult QCborStreamReader::readByteArray() - - Decodes one byte array chunk from the CBOR string and returns it. This - function is used for both regular and chunked contents, so the caller must - always loop around calling this function, even if isLengthKnown() has - is true. The typical use of this function is as follows: - - \snippet code/src_corelib_serialization_qcborstream.cpp 28 - - This function does not perform any type conversions, including from integers - or from strings. Therefore, it may only be called if isByteArray() is true; - calling it in any other condition is an error. - - \sa readString(), isByteArray(), readStringChunk() - */ -QCborStreamReader::StringResult QCborStreamReader::_readByteArray_helper() -{ - QCborStreamReader::StringResult result; - result.status = Error; - qsizetype len = _currentStringChunkSize(); - if (len < 0) - return result; - - result.data.resize(len); - auto r = readStringChunk(result.data.data(), len); - Q_ASSERT(r.status != Ok || r.data == len); - result.status = r.status; - return result; -} - -/*! - \fn qsizetype QCborStreamReader::currentStringChunkSize() const - - Returns the size of the current text or byte string chunk. If the CBOR - stream contains a non-chunked string (that is, if isLengthKnown() returns - \c true), this function returns the size of the entire string, the same as - length(). - - This function is useful to pre-allocate the buffer whose pointer can be passed - to readStringChunk() later. - - \sa readString(), readByteArray(), readStringChunk() - */ -qsizetype QCborStreamReader::_currentStringChunkSize() const -{ - if (!d->ensureStringIteration()) - return -1; - - size_t len; - CborError err = cbor_value_get_string_chunk_size(&d->currentElement, &len); - if (err == CborErrorNoMoreStringChunks) - return 0; // not a real error - else if (err) - d->handleError(err); - else if (qsizetype(len) < 0) - d->handleError(CborErrorDataTooLarge); - else - return qsizetype(len); - return -1; -} - -/*! - Reads the current string chunk into the buffer pointed to by \a ptr, whose - size is \a maxlen. This function returns a \l StringResult object, with the - number of bytes copied into \a ptr saved in the \c \l StringResult::data - member. The \c \l StringResult::status member indicates whether there was - an error reading the string, whether data was copied or whether this was - the last chunk. - - This function can be called for both \l String and \l ByteArray types. - For the latter, this function will read the same data that readByteArray() - would have returned. For strings, it returns the UTF-8 equivalent of the \l - QString that would have been returned. - - This function is usually used alongside currentStringChunkSize() in a loop. - For example: - - \snippet code/src_corelib_serialization_qcborstream.cpp 29 - - Unlike readByteArray() and readString(), this function is not limited by - implementation limits of QByteArray and QString. - - \note This function does not perform verification that the UTF-8 contents - are properly formatted. That means this function does not produce the - QCborError::InvalidUtf8String error, even when readString() does. - - \sa currentStringChunkSize(), readString(), readByteArray(), - isString(), isByteArray() - */ -QCborStreamReader::StringResult -QCborStreamReader::readStringChunk(char *ptr, qsizetype maxlen) -{ - CborError err; - size_t len; - const void *content = nullptr; - QCborStreamReader::StringResult result; - result.data = 0; - result.status = Error; - - d->lastError = {}; - if (!d->ensureStringIteration()) - return result; - -#if 1 - // Using internal TinyCBOR API! - err = _cbor_value_get_string_chunk(&d->currentElement, &content, &len, &d->currentElement); -#else - // the above is effectively the same as: - if (cbor_value_is_byte_string(¤tElement)) - err = cbor_value_get_byte_string_chunk(&d->currentElement, reinterpret_cast(&content), - &len, &d->currentElement); - else - err = cbor_value_get_text_string_chunk(&d->currentElement, reinterpret_cast(&content), - &len, &d->currentElement); -#endif - - // Range check: using implementation-defined behavior in converting an - // unsigned value out of range of the destination signed type (same as - // "len > size_t(std::numeric_limits::max())", but generates - // better code with ICC and MSVC). - if (!err && qsizetype(len) < 0) - err = CborErrorDataTooLarge; - - if (err) { - if (err == CborErrorNoMoreStringChunks) { - d->preread(); - err = cbor_value_finish_string_iteration(&d->currentElement); - result.status = EndOfString; - } - if (err) - d->handleError(err); - else - preparse(); - return result; - } - - // Read the chunk into the user's buffer. - qint64 actuallyRead; - qptrdiff offset = qptrdiff(content); - qsizetype toRead = qsizetype(len); - qsizetype left = toRead - maxlen; - if (left < 0) - left = 0; // buffer bigger than string - else - toRead = maxlen; // buffer smaller than string - - if (d->device) { - // This first skip can't fail because we've already read this many bytes. - d->device->skip(d->bufferStart + qptrdiff(content)); - actuallyRead = d->device->read(ptr, toRead); - - if (actuallyRead != toRead) { - actuallyRead = -1; - } else if (left) { - qint64 skipped = d->device->skip(left); - if (skipped != left) - actuallyRead = -1; - } - - if (actuallyRead < 0) { - d->handleError(CborErrorIO); - return result; - } - - d->updateBufferAfterString(offset, len); - } else { - actuallyRead = toRead; - memcpy(ptr, d->buffer.constData() + d->bufferStart + offset, toRead); - d->bufferStart += QByteArray::size_type(offset + len); - } - - d->preread(); - result.data = actuallyRead; - result.status = Ok; - return result; -} - -QT_END_NAMESPACE - -#include "moc_qcborcommon.cpp" -#include "moc_qcborstream.cpp" diff --git a/src/corelib/serialization/qcborstream.h b/src/corelib/serialization/qcborstream.h index 08bf680cca..f2b88820cd 100644 --- a/src/corelib/serialization/qcborstream.h +++ b/src/corelib/serialization/qcborstream.h @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -40,230 +41,17 @@ #ifndef QCBORSTREAM_H #define QCBORSTREAM_H -#include -#include -#include -#include -#include -#include +#include -QT_REQUIRE_CONFIG(cborstream); - -// See qcborcommon.h for why we check -#if defined(QT_X11_DEFINES_FOUND) -# undef True -# undef False +#if QT_CONFIG(cborstreamreader) +#include #endif -QT_BEGIN_NAMESPACE - -class QIODevice; - -enum class QCborNegativeInteger : quint64 {}; - -class QCborStreamWriterPrivate; -class Q_CORE_EXPORT QCborStreamWriter -{ -public: - explicit QCborStreamWriter(QIODevice *device); - explicit QCborStreamWriter(QByteArray *data); - ~QCborStreamWriter(); - Q_DISABLE_COPY(QCborStreamWriter) - - void setDevice(QIODevice *device); - QIODevice *device() const; - - void append(quint64 u); - void append(qint64 i); - void append(QCborNegativeInteger n); - void append(const QByteArray &ba) { appendByteString(ba.constData(), ba.size()); } - void append(QLatin1String str); - void append(QStringView str); - void append(QCborTag tag); - void append(QCborKnownTags tag) { append(QCborTag(tag)); } - void append(QCborSimpleType st); - void append(std::nullptr_t) { append(QCborSimpleType::Null); } - void append(qfloat16 f); - void append(float f); - void append(double d); - - void appendByteString(const char *data, qsizetype len); - void appendTextString(const char *utf8, qsizetype len); - - // convenience - void append(bool b) { append(b ? QCborSimpleType::True : QCborSimpleType::False); } - void appendNull() { append(QCborSimpleType::Null); } - void appendUndefined() { append(QCborSimpleType::Undefined); } - -#ifndef Q_QDOC - // overloads to make normal code not complain - void append(int i) { append(qint64(i)); } - void append(uint u) { append(quint64(u)); } -#endif -#ifndef QT_NO_CAST_FROM_ASCII - void append(const char *str, qsizetype size = -1) - { appendTextString(str, (str && size == -1) ? int(strlen(str)) : size); } +#if QT_CONFIG(cborstreamwriter) +#include #endif - void startArray(); - void startArray(quint64 count); - bool endArray(); - void startMap(); - void startMap(quint64 count); - bool endMap(); - - // no API for encoding chunked strings - -private: - QScopedPointer d; -}; - -class QCborStreamReaderPrivate; -class Q_CORE_EXPORT QCborStreamReader -{ - Q_GADGET -public: - enum Type : quint8 { - UnsignedInteger = 0x00, - NegativeInteger = 0x20, - ByteString = 0x40, - ByteArray = ByteString, - TextString = 0x60, - String = TextString, - Array = 0x80, - Map = 0xa0, - Tag = 0xc0, - SimpleType = 0xe0, - HalfFloat = 0xf9, - Float16 = HalfFloat, - Float = 0xfa, - Double = 0xfb, - - Invalid = 0xff - }; - Q_ENUM(Type) - - enum StringResultCode { - EndOfString = 0, - Ok = 1, - Error = -1 - }; - template struct StringResult { - Container data; - StringResultCode status = Error; - }; - Q_ENUM(StringResultCode) - - QCborStreamReader(); - QCborStreamReader(const char *data, qsizetype len); - QCborStreamReader(const quint8 *data, qsizetype len); - explicit QCborStreamReader(const QByteArray &data); - explicit QCborStreamReader(QIODevice *device); - ~QCborStreamReader(); - Q_DISABLE_COPY(QCborStreamReader) - - void setDevice(QIODevice *device); - QIODevice *device() const; - void addData(const QByteArray &data); - void addData(const char *data, qsizetype len); - void addData(const quint8 *data, qsizetype len) - { addData(reinterpret_cast(data), len); } - void reparse(); - void clear(); - void reset(); - - QCborError lastError(); - - qint64 currentOffset() const; - - bool isValid() const { return !isInvalid(); } - - int containerDepth() const; - QCborStreamReader::Type parentContainerType() const; - bool hasNext() const noexcept Q_DECL_PURE_FUNCTION; - bool next(int maxRecursion = 10000); - - Type type() const { return QCborStreamReader::Type(type_); } - bool isUnsignedInteger() const { return type() == UnsignedInteger; } - bool isNegativeInteger() const { return type() == NegativeInteger; } - bool isInteger() const { return quint8(type()) <= quint8(NegativeInteger); } - bool isByteArray() const { return type() == ByteArray; } - bool isString() const { return type() == String; } - bool isArray() const { return type() == Array; } - bool isMap() const { return type() == Map; } - bool isTag() const { return type() == Tag; } - bool isSimpleType() const { return type() == SimpleType; } - bool isFloat16() const { return type() == Float16; } - bool isFloat() const { return type() == Float; } - bool isDouble() const { return type() == Double; } - bool isInvalid() const { return type() == Invalid; } - - bool isSimpleType(QCborSimpleType st) const { return isSimpleType() && toSimpleType() == st; } - bool isFalse() const { return isSimpleType(QCborSimpleType::False); } - bool isTrue() const { return isSimpleType(QCborSimpleType::True); } - bool isBool() const { return isFalse() || isTrue(); } - bool isNull() const { return isSimpleType(QCborSimpleType::Null); } - bool isUndefined() const { return isSimpleType(QCborSimpleType::Undefined); } - - bool isLengthKnown() const noexcept Q_DECL_PURE_FUNCTION; - quint64 length() const; - - bool isContainer() const { return isMap() || isArray(); } - bool enterContainer() { Q_ASSERT(isContainer()); return _enterContainer_helper(); } - bool leaveContainer(); - - StringResult readString() { Q_ASSERT(isString()); return _readString_helper(); } - StringResult readByteArray(){ Q_ASSERT(isByteArray()); return _readByteArray_helper(); } - qsizetype currentStringChunkSize() const{ Q_ASSERT(isString() || isByteArray()); return _currentStringChunkSize(); } - StringResult readStringChunk(char *ptr, qsizetype maxlen); - - bool toBool() const { Q_ASSERT(isBool()); return value64 - int(QCborSimpleType::False); } - QCborTag toTag() const { Q_ASSERT(isTag()); return QCborTag(value64); } - quint64 toUnsignedInteger() const { Q_ASSERT(isUnsignedInteger()); return value64; } - QCborNegativeInteger toNegativeInteger() const { Q_ASSERT(isNegativeInteger()); return QCborNegativeInteger(value64 + 1); } - QCborSimpleType toSimpleType() const{ Q_ASSERT(isSimpleType()); return QCborSimpleType(value64); } - qfloat16 toFloat16() const { Q_ASSERT(isFloat16()); return _toFloatingPoint(); } - float toFloat() const { Q_ASSERT(isFloat()); return _toFloatingPoint(); } - double toDouble() const { Q_ASSERT(isDouble()); return _toFloatingPoint(); } - - qint64 toInteger() const - { - Q_ASSERT(isInteger()); - qint64 v = qint64(value64); - if (isNegativeInteger()) - return -v - 1; - return v; - } - -private: - void preparse(); - bool _enterContainer_helper(); - StringResult _readString_helper(); - StringResult _readByteArray_helper(); - qsizetype _currentStringChunkSize() const; - - template FP _toFloatingPoint() const noexcept - { - using UIntFP = typename QIntegerForSizeof::Unsigned; - UIntFP u = UIntFP(value64); - FP f; - memcpy(static_cast(&f), &u, sizeof(f)); - return f; - } - - friend QCborStreamReaderPrivate; - friend class QCborContainerPrivate; - quint64 value64; - QScopedPointer d; - quint8 type_; - quint8 reserved[3] = {}; -}; - +QT_BEGIN_NAMESPACE QT_END_NAMESPACE -#if defined(QT_X11_DEFINES_FOUND) -# define True 1 -# define False 0 -#endif - #endif // QCBORSTREAM_H diff --git a/src/corelib/serialization/qcborstreamreader.cpp b/src/corelib/serialization/qcborstreamreader.cpp new file mode 100644 index 0000000000..112fc6e226 --- /dev/null +++ b/src/corelib/serialization/qcborstreamreader.cpp @@ -0,0 +1,1533 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcborstreamreader.h" + +#define CBOR_NO_ENCODER_API +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static bool qt_cbor_decoder_can_read(void *token, size_t len); +static void qt_cbor_decoder_advance(void *token, size_t len); +static void *qt_cbor_decoder_read(void *token, void *userptr, size_t offset, size_t len); +static CborError qt_cbor_decoder_transfer_string(void *token, const void **userptr, size_t offset, size_t len); + +#define CBOR_PARSER_READER_CONTROL 1 +#define CBOR_PARSER_CAN_READ_BYTES_FUNCTION qt_cbor_decoder_can_read +#define CBOR_PARSER_ADVANCE_BYTES_FUNCTION qt_cbor_decoder_advance +#define CBOR_PARSER_TRANSFER_STRING_FUNCTION qt_cbor_decoder_transfer_string +#define CBOR_PARSER_READ_BYTES_FUNCTION qt_cbor_decoder_read + +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4334) // '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) + +#include + +QT_WARNING_POP + +static CborError _cbor_value_dup_string(const CborValue *, void **, size_t *, CborValue *) +{ + Q_UNREACHABLE(); + return CborErrorInternalError; +} +static CborError cbor_value_get_half_float_as_float(const CborValue *, float *) +{ + Q_UNREACHABLE(); + return CborErrorInternalError; +} + +// confirm our constants match TinyCBOR's +Q_STATIC_ASSERT(int(QCborStreamReader::UnsignedInteger) == CborIntegerType); +Q_STATIC_ASSERT(int(QCborStreamReader::ByteString) == CborByteStringType); +Q_STATIC_ASSERT(int(QCborStreamReader::TextString) == CborTextStringType); +Q_STATIC_ASSERT(int(QCborStreamReader::Array) == CborArrayType); +Q_STATIC_ASSERT(int(QCborStreamReader::Map) == CborMapType); +Q_STATIC_ASSERT(int(QCborStreamReader::Tag) == CborTagType); +Q_STATIC_ASSERT(int(QCborStreamReader::SimpleType) == CborSimpleType); +Q_STATIC_ASSERT(int(QCborStreamReader::HalfFloat) == CborHalfFloatType); +Q_STATIC_ASSERT(int(QCborStreamReader::Float) == CborFloatType); +Q_STATIC_ASSERT(int(QCborStreamReader::Double) == CborDoubleType); +Q_STATIC_ASSERT(int(QCborStreamReader::Invalid) == CborInvalidType); + +/*! + \class QCborStreamReader + \inmodule QtCore + \ingroup cbor + \reentrant + \since 5.12 + + \brief The QCborStreamReader class is a simple CBOR stream decoder, operating + on either a QByteArray or QIODevice. + + This class can be used to decode a stream of CBOR content directly from + either a QByteArray or a QIODevice. CBOR is the Concise Binary Object + Representation, a very compact form of binary data encoding that is + compatible with JSON. It was created by the IETF Constrained RESTful + Environments (CoRE) WG, which has used it in many new RFCs. It is meant to + be used alongside the \l{https://tools.ietf.org/html/rfc7252}{CoAP + protocol}. + + QCborStreamReader provides a StAX-like API, similar to that of + \l{QXmlStreamReader}. Using it requires a bit of knowledge of CBOR encoding. + For a simpler API, see \l{QCborValue} and especially the decoding function + QCborValue::fromCbor(). + + Typically, one creates a QCborStreamReader by passing the source QByteArray + or QIODevice as a parameter to the constructor, then pop elements off the + stream if there were no errors in decoding. There are three kinds of CBOR + types: + + \table + \header \li Kind \li Types \li Behavior + \row \li Fixed-width \li Integers, Tags, Simple types, Floating point + \li Value is pre-parsed by QCborStreamReader, so accessor functions + are \c const. Must call next() to advance. + \row \li Strings \li Byte arrays, Text strings + \li Length (if known) is pre-parsed, but the string itself is not. + The accessor functions are not const and may allocate memory. + Once called, the accessor functions automatically advance to + the next element. + \row \li Containers \li Arrays, Maps + \li Length (if known) is pre-parsed. To access the elements, you + must call enterContainer(), read all elements, then call + leaveContainer(). That function advances to the next element. + \endtable + + So a processor function typically looks like this: + + \snippet code/src_corelib_serialization_qcborstream.cpp 24 + + \section1 CBOR support + + The following table lists the CBOR features that QCborStreamReader supports. + + \table + \header \li Feature \li Support + \row \li Unsigned numbers \li Yes (full range) + \row \li Negative numbers \li Yes (full range) + \row \li Byte strings \li Yes + \row \li Text strings \li Yes + \row \li Chunked strings \li Yes + \row \li Tags \li Yes (arbitrary) + \row \li Booleans \li Yes + \row \li Null \li Yes + \row \li Undefined \li Yes + \row \li Arbitrary simple values \li Yes + \row \li Half-precision float (16-bit) \li Yes + \row \li Single-precision float (32-bit) \li Yes + \row \li Double-precision float (64-bit) \li Yes + \row \li Infinities and NaN floating point \li Yes + \row \li Determinate-length arrays and maps \li Yes + \row \li Indeterminate-length arrays and maps \li Yes + \row \li Map key types other than strings and integers \li Yes (arbitrary) + \endtable + + \section1 Dealing with invalid or incomplete CBOR streams + + QCborStreamReader is capable of detecting corrupt input on its own. The + library it uses has been extensively tested against invalid input of any + kind and is quite able to report errors. If any is detected, + QCborStreamReader will set lastError() to a value besides + QCborError::NoError, indicating which situation was detected. + + Most errors detected by QCborStreamReader during normal item parsing are not + recoverable. The code using QCborStreamReader may opt to handle the data + that was properly decoded or it can opt to discard the entire data. + + The only recoverable error is QCborError::EndOfFile, which indicates that + more data is required in order to complete the parsing. This situation is + useful when data is being read from an asynchronous source, such as a pipe + (QProcess) or a socket (QTcpSocket, QUdpSocket, QNetworkReply, etc.). When + more data arrives, the surrounding code needs to call either addData(), if + parsing from a QByteArray, or reparse(), if it is instead reading directly + a the QIDOevice that now has more data available (see setDevice()). + + \sa QCborStreamWriter, QCborValue, QXmlStreamReader + */ + +/*! + \enum QCborStreamReader::Type + + This enumeration contains all possible CBOR types as decoded by + QCborStreamReader. CBOR has 7 major types, plus a number of simple types + carrying no value, and floating point values. + + \value UnsignedInteger (Major type 0) Ranges from 0 to 2\sup{64} - 1 + (18,446,744,073,709,551,616) + \value NegativeInteger (Major type 1) Ranges from -1 to -2\sup{64} + (-18,446,744,073,709,551,616) + \value ByteArray (Major type 2) Arbitrary binary data. + \value ByteString An alias to ByteArray. + \value String (Major type 3) Unicode text, possibly containing NULs. + \value TextString An alias to String + \value Array (Major type 4) Array of heterogeneous items. + \value Map (Major type 5) Map/dictionary of heterogeneous items. + \value Tag (Major type 6) Numbers giving further semantic value + to generic CBOR items. See \l QCborTag for more information. + \value SimpleType (Major type 7) Types carrying no further value. Includes + booleans (true and false), null, undefined. + \value Float16 IEEE 754 half-precision floating point (\c qfloat16). + \value HalfFloat An alias to Float16. + \value Float IEEE 754 single-precision floating point (\tt float). + \value Double IEEE 754 double-precision floating point (\tt double). + \value Invalid Not a valid type, either due to parsing error or due to + reaching the end of an array or map. + */ + +/*! + \enum QCborStreamReader::StringResultCode + + This enum is returned by readString() and readByteArray() and is used to + indicate what the status of the parsing is. + + \value EndOfString The parsing for the string is complete, with no error. + \value Ok The function returned data; there was no error. + \value Error Parsing failed with an error. + */ + +/*! + \class QCborStreamReader::StringResult + \inmodule QtCore + + This class is returned by readString() and readByteArray(), with either the + contents of the string that was read or an indication that the parsing is + done or found an error. + + The contents of \l data are valid only if \l status is + \l{StringResultCode}{Ok}. Otherwise, it should be null. + */ + +/*! + \variable QCborStreamReader::StringResult::data + + Contains the actual data from the string if \l status is \c Ok. + */ + +/*! + \variable QCborStreamReader::StringResult::status + + Contains the status of the attempt of reading the string from the stream. + */ + +/*! + \fn QCborStreamReader::Type QCborStreamReader::type() const + + Returns the type of the current element. It is one of the valid types or + Invalid. + + \sa isValid(), isUnsignedInteger(), isNegativeInteger(), isInteger(), + isByteArray(), isString(), isArray(), isMap(), isTag(), isSimpleType(), + isBool(), isFalse(), isTrue(), isNull(), isUndefined(), isFloat16(), + isFloat(), isDouble() + */ + +/*! + \fn bool QCborStreamReader::isValid() const + + Returns true if the current element is valid, false otherwise. The current + element may be invalid if there was a decoding error or we've just parsed + the last element in an array or map. + + \note This function is not the opposite of isNull(). Null is a normal CBOR + type that must be handled by the application. + + \sa type(), isInvalid() + */ + +/*! + \fn bool QCborStreamReader::isInvalid() const + + Returns true if the current element is invalid, false otherwise. The current + element may be invalid if there was a decoding error or we've just parsed + the last element in an array or map. + + \note This function is not to be confused with isNull(). Null is a normal + CBOR type that must be handled by the application. + + \sa type(), isValid() + */ + +/*! + \fn bool QCborStreamReader::isUnsignedInteger() const + + Returns true if the type of the current element is an unsigned integer (that + is if type() returns QCborStreamReader::UnsignedInteger). If this function + returns true, you may call toUnsignedInteger() or toInteger() to read that value. + + \sa type(), toUnsignedInteger(), toInteger(), isInteger(), isNegativeInteger() + */ + +/*! + \fn bool QCborStreamReader::isNegativeInteger() const + + Returns true if the type of the current element is a negative integer (that + is if type() returns QCborStreamReader::NegativeInteger). If this function + returns true, you may call toNegativeInteger() or toInteger() to read that value. + + \sa type(), toNegativeInteger(), toInteger(), isInteger(), isUnsignedInteger() + */ + +/*! + \fn bool QCborStreamReader::isInteger() const + + Returns true if the type of the current element is either an unsigned + integer or a negative one (that is, if type() returns + QCborStreamReader::UnsignedInteger or QCborStreamReader::NegativeInteger). + If this function returns true, you may call toInteger() to read that + value. + + \sa type(), toInteger(), toUnsignedInteger(), toNegativeInteger(), + isUnsignedInteger(), isNegativeInteger() + */ + +/*! + \fn bool QCborStreamReader::isByteArray() const + + Returns true if the type of the current element is a byte array (that is, + if type() returns QCborStreamReader::ByteArray). If this function returns + true, you may call readByteArray() to read that data. + + \sa type(), readByteArray(), isString() + */ + +/*! + \fn bool QCborStreamReader::isString() const + + Returns true if the type of the current element is a text string (that is, + if type() returns QCborStreamReader::String). If this function returns + true, you may call readString() to read that data. + + \sa type(), readString(), isByteArray() + */ + +/*! + \fn bool QCborStreamReader::isArray() const + + Returns true if the type of the current element is an array (that is, + if type() returns QCborStreamReader::Array). If this function returns + true, you may call enterContainer() to begin parsing that container. + + When the current element is an array, you may also call isLengthKnown() to + find out if the array's size is explicit in the CBOR stream. If it is, that + size can be obtained by calling length(). + + The following example pre-allocates a QVariantList given the array's size + for more efficient decoding: + + \snippet code/src_corelib_serialization_qcborstream.cpp 25 + + \note The code above does not validate that the length is a sensible value. + If the input stream reports that the length is 1 billion elements, the above + function will try to allocate some 16 GB or more of RAM, which can lead to a + crash. + + \sa type(), isMap(), isLengthKnown(), length(), enterContainer(), leaveContainer() + */ + +/*! + \fn bool QCborStreamReader::isMap() const + + Returns true if the type of the current element is a map (that is, if type() + returns QCborStreamReader::Map). If this function returns true, you may call + enterContainer() to begin parsing that container. + + When the current element is a map, you may also call isLengthKnown() to + find out if the map's size is explicit in the CBOR stream. If it is, that + size can be obtained by calling length(). + + The following example pre-allocates a QVariantMap given the map's size + for more efficient decoding: + + \snippet code/src_corelib_serialization_qcborstream.cpp 26 + + The example above uses a function called \c readElementAsString to read the + map's keys and obtain a string. That is because CBOR maps may contain any + type as keys, not just strings. User code needs to either perform this + conversion, reject non-string keys, or instead use a different container + besides \l QVariantMap and \l QVariantHash. For example, if the map is + expected to contain integer keys, which is recommended as it reduces stream + size and parsing, the correct container would be \c{\l{QMap}} + or \c{\l{QHash}}. + + \note The code above does not validate that the length is a sensible value. + If the input stream reports that the length is 1 billion elements, the above + function will try to allocate some 24 GB or more of RAM, which can lead to a + crash. + + \sa type(), isArray(), isLengthKnown(), length(), enterContainer(), leaveContainer() + */ + +/*! + \fn bool QCborStreamReader::isTag() const + + Returns true if the type of the current element is a CBOR tag (that is, + if type() returns QCborStreamReader::Tag). If this function returns + true, you may call toTag() to read that data. + + \sa type(), toTag() + */ + +/*! + \fn bool QCborStreamReader::isFloat16() const + + Returns true if the type of the current element is an IEEE 754 + half-precision floating point (that is, if type() returns + QCborStreamReader::Float16). If this function returns true, you may call + toFloat16() to read that data. + + \sa type(), toFloat16(), isFloat(), isDouble() + */ + +/*! + \fn bool QCborStreamReader::isFloat() const + + Returns true if the type of the current element is an IEEE 754 + single-precision floating point (that is, if type() returns + QCborStreamReader::Float). If this function returns true, you may call + toFloat() to read that data. + + \sa type(), toFloat(), isFloat16(), isDouble() + */ + +/*! + \fn bool QCborStreamReader::isDouble() const + + Returns true if the type of the current element is an IEEE 754 + double-precision floating point (that is, if type() returns + QCborStreamReader::Double). If this function returns true, you may call + toDouble() to read that data. + + \sa type(), toDouble(), isFloat16(), isFloat() + */ + +/*! + \fn bool QCborStreamReader::isSimpleType() const + + Returns true if the type of the current element is any CBOR simple type, + including a boolean value (true and false) as well as null and undefined. To + find out which simple type this is, call toSimpleType(). Alternatively, to + test for one specific simple type, call the overload that takes a + QCborSimpleType parameter. + + CBOR simple types are types that do not carry extra value. There are 255 + possibilities, but there are currently only four values that have defined + meaning. Code is not expected to cope with unknown simple types and may + simply discard the stream as invalid if it finds an unknown one. + + \sa QCborSimpleType, type(), isSimpleType(QCborSimpleType), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isSimpleType(QCborSimpleType st) const + + Returns true if the type of the current element is the simple type \a st, + false otherwise. If this function returns true, then toSimpleType() will + return \a st. + + CBOR simple types are types that do not carry extra value. There are 255 + possibilities, but there are currently only four values that have defined + meaning. Code is not expected to cope with unknown simple types and may + simply discard the stream as invalid if it finds an unknown one. + + \sa QCborSimpleType, type(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isFalse() const + + Returns true if the current element is the \c false value, false if it is + anything else. + + \sa type(), isTrue(), isBool(), toBool(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isTrue() const + + Returns true if the current element is the \c true value, false if it is + anything else. + + \sa type(), isFalse(), isBool(), toBool(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isBool() const + + Returns true if the current element is a boolean value (\c true or \c + false), false if it is anything else. If this function returns true, you may + call toBool() to retrieve the value of the boolean. You may also call + toSimpleType() and compare to either QCborSimpleValue::True or + QCborSimpleValue::False. + + \sa type(), isFalse(), isTrue(), toBool(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isNull() const + + Returns true if the current element is the \c null value, false if it is + anything else. Null values may be used to indicate the absence of some + optional data. + + \note This function is not the opposite of isValid(). A Null value is a + valid CBOR value. + + \sa type(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isUndefined() const + + Returns true if the current element is the \c undefined value, false if it + is anything else. Undefined values may be encoded to indicate that some + conversion failed or was not possible when creating the stream. + QCborStreamReader never performs any replacement and this function will only + return true if the stream contains an explicit undefined value. + + \sa type(), isSimpleType(), toSimpleType() + */ + +/*! + \fn bool QCborStreamReader::isContainer() const + + Returns true if the current element is a container (that is, an array or a + map), false if it is anything else. If the current element is a container, + the isLengthKnown() function may be used to find out if the container's size + is explicit in the stream and, if so, length() can be used to get that size. + + More importantly, for a container, the enterContainer() function is + available to begin iterating through the elements contained therein. + + \sa type(), isArray(), isMap(), isLengthKnown(), length(), enterContainer(), + leaveContainer(), containerDepth() + */ + +class QCborStreamReaderPrivate +{ +public: + enum { + // 9 bytes is the maximum size for any integer, floating point or + // length in CBOR. + MaxCborIndividualSize = 9, + IdealIoBufferSize = 256 + }; + + QIODevice *device; + QByteArray buffer; + QStack containerStack; + + CborParser parser; + CborValue currentElement; + QCborError lastError = {}; + + QByteArray::size_type bufferStart; + bool corrupt = false; + + QCborStreamReaderPrivate(const QByteArray &data) + : device(nullptr), buffer(data) + { + initDecoder(); + } + + QCborStreamReaderPrivate(QIODevice *device) + { + setDevice(device); + } + + ~QCborStreamReaderPrivate() + { + } + + void setDevice(QIODevice *dev) + { + buffer.clear(); + device = dev; + initDecoder(); + } + + void initDecoder() + { + containerStack.clear(); + bufferStart = 0; + if (device) { + buffer.clear(); + buffer.reserve(IdealIoBufferSize); // sets the CapacityReserved flag + } + + preread(); + if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this)) + handleError(err); + else + lastError = { QCborError::NoError }; + } + + char *bufferPtr() + { + Q_ASSERT(buffer.isDetached()); + return const_cast(buffer.constData()) + bufferStart; + } + + void preread() + { + if (device && buffer.size() - bufferStart < MaxCborIndividualSize) { + // load more, but only if there's more to be read + qint64 avail = device->bytesAvailable(); + Q_ASSERT(avail >= buffer.size()); + if (avail == buffer.size()) + return; + + if (bufferStart) + device->skip(bufferStart); // skip what we've already parsed + + if (buffer.size() != IdealIoBufferSize) + buffer.resize(IdealIoBufferSize); + + bufferStart = 0; + qint64 read = device->peek(bufferPtr(), IdealIoBufferSize); + if (read < 0) + buffer.clear(); + else if (read != IdealIoBufferSize) + buffer.truncate(read); + } + } + + void handleError(CborError err) noexcept + { + Q_ASSERT(err); + + // is the error fatal? + if (err != CborErrorUnexpectedEOF) + corrupt = true; + + lastError = QCborError { QCborError::Code(int(err)) }; + } + + void updateBufferAfterString(qsizetype offset, qsizetype size) + { + Q_ASSERT(device); + + bufferStart += offset; + qsizetype newStart = bufferStart + size; + qsizetype remainingInBuffer = buffer.size() - newStart; + + if (remainingInBuffer <= 0) { + // We've read from the QIODevice more than what was in the buffer. + buffer.truncate(0); + } else { + // There's still data buffered, but we need to move it around. + char *ptr = buffer.data(); + memmove(ptr, ptr + newStart, remainingInBuffer); + buffer.truncate(remainingInBuffer); + } + + bufferStart = 0; + } + + bool ensureStringIteration(); +}; + +void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error) +{ + d->handleError(CborError(error.c)); +} + +static inline bool qt_cbor_decoder_can_read(void *token, size_t len) +{ + Q_ASSERT(len <= QCborStreamReaderPrivate::MaxCborIndividualSize); + auto self = static_cast(token); + + qint64 avail = self->buffer.size() - self->bufferStart; + return len <= quint64(avail); +} + +static void qt_cbor_decoder_advance(void *token, size_t len) +{ + Q_ASSERT(len <= QCborStreamReaderPrivate::MaxCborIndividualSize); + auto self = static_cast(token); + Q_ASSERT(len <= size_t(self->buffer.size() - self->bufferStart)); + + self->bufferStart += int(len); + self->preread(); +} + +static void *qt_cbor_decoder_read(void *token, void *userptr, size_t offset, size_t len) +{ + Q_ASSERT(len == 1 || len == 2 || len == 4 || len == 8); + Q_ASSERT(offset == 0 || offset == 1); + auto self = static_cast(token); + + // we must have pre-read the data + Q_ASSERT(len + offset <= size_t(self->buffer.size() - self->bufferStart)); + return memcpy(userptr, self->buffer.constData() + self->bufferStart + offset, len); +} + +static CborError qt_cbor_decoder_transfer_string(void *token, const void **userptr, size_t offset, size_t len) +{ + auto self = static_cast(token); + Q_ASSERT(offset <= size_t(self->buffer.size())); + Q_STATIC_ASSERT(sizeof(size_t) >= sizeof(QByteArray::size_type)); + Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); + + // check that we will have enough data from the QIODevice before we advance + // (otherwise, we'd lose the length information) + qsizetype total; + if (len > size_t(std::numeric_limits::max()) + || add_overflow(offset, len, &total)) + return CborErrorDataTooLarge; + + // our string transfer is just saving the offset to the userptr + *userptr = reinterpret_cast(offset); + + qint64 avail = (self->device ? self->device->bytesAvailable() : self->buffer.size()) - + self->bufferStart; + return total > avail ? CborErrorUnexpectedEOF : CborNoError; +} + +bool QCborStreamReaderPrivate::ensureStringIteration() +{ + if (currentElement.flags & CborIteratorFlag_IteratingStringChunks) + return true; + + CborError err = cbor_value_begin_string_iteration(¤tElement); + if (!err) + return true; + handleError(err); + return false; +} + +/*! + \internal + */ +inline void QCborStreamReader::preparse() +{ + if (lastError() == QCborError::NoError) { + type_ = cbor_value_get_type(&d->currentElement); + + if (type_ == CborInvalidType) { + // We may have reached the end. + if (d->device && d->containerStack.isEmpty()) { + d->buffer.clear(); + if (d->bufferStart) + d->device->skip(d->bufferStart); + d->bufferStart = 0; + } + } else { + d->lastError = {}; + // Undo the type mapping that TinyCBOR does (we have an explicit type + // for negative integer and we don't have separate types for Boolean, + // Null and Undefined). + if (type_ == CborBooleanType || type_ == CborNullType || type_ == CborUndefinedType) { + type_ = CborSimpleType; + value64 = quint8(d->buffer.at(d->bufferStart)) - CborSimpleType; + } else { + // Using internal TinyCBOR API! + value64 = _cbor_value_extract_int64_helper(&d->currentElement); + + if (cbor_value_is_negative_integer(&d->currentElement)) + type_ = quint8(QCborStreamReader::NegativeInteger); + } + } + } else { + type_ = Invalid; + } +} + +/*! + Creates a QCborStreamReader object with no source data. After construction, + QCborStreamReader will report an error parsing. + + You can add more data by calling addData() or by setting a different source + device using setDevice(). + + \sa addData(), isValid() + */ +QCborStreamReader::QCborStreamReader() + : QCborStreamReader(QByteArray()) +{ +} + +/*! + \overload + + Creates a QCborStreamReader object with \a len bytes of data starting at \a + data. The pointer must remain valid until QCborStreamReader is destroyed. + */ +QCborStreamReader::QCborStreamReader(const char *data, qsizetype len) + : QCborStreamReader(QByteArray::fromRawData(data, len)) +{ +} + +/*! + \overload + + Creates a QCborStreamReader object with \a len bytes of data starting at \a + data. The pointer must remain valid until QCborStreamReader is destroyed. + */ +QCborStreamReader::QCborStreamReader(const quint8 *data, qsizetype len) + : QCborStreamReader(QByteArray::fromRawData(reinterpret_cast(data), len)) +{ +} + +/*! + \overload + + Creates a QCborStreamReader object that will parse the CBOR stream found in + \a data. + */ +QCborStreamReader::QCborStreamReader(const QByteArray &data) + : d(new QCborStreamReaderPrivate(data)) +{ + preparse(); +} + +/*! + \overload + + Creates a QCborStreamReader object that will parse the CBOR stream found by + reading from \a device. QCborStreamReader does not take ownership of \a + device, so it must remain valid until this oject is destroyed. + */ +QCborStreamReader::QCborStreamReader(QIODevice *device) + : d(new QCborStreamReaderPrivate(device)) +{ + preparse(); +} + +/*! + Destroys this QCborStreamReader object and frees any associated resources. + */ +QCborStreamReader::~QCborStreamReader() +{ +} + +/*! + Sets the source of data to \a device, resetting the decoder to its initial + state. + */ +void QCborStreamReader::setDevice(QIODevice *device) +{ + d->setDevice(device); + preparse(); +} + +/*! + Returns the QIODevice that was set with either setDevice() or the + QCborStreamReader constructor. If this object was reading from a QByteArray, + this function returns nullptr instead. + */ +QIODevice *QCborStreamReader::device() const +{ + return d->device; +} + +/*! + Adds \a data to the CBOR stream and reparses the current element. This + function is useful if the end of the data was previously reached while + processing the stream, but now more data is available. + */ +void QCborStreamReader::addData(const QByteArray &data) +{ + addData(data.constData(), data.size()); +} + +/*! + \fn void QCborStreamReader::addData(const quint8 *data, qsizetype len) + \overload + + Adds \a len bytes of data starting at \a data to the CBOR stream and + reparses the current element. This function is useful if the end of the data + was previously reached while processing the stream, but now more data is + available. + */ + +/*! + \overload + + Adds \a len bytes of data starting at \a data to the CBOR stream and + reparses the current element. This function is useful if the end of the data + was previously reached while processing the stream, but now more data is + available. + */ +void QCborStreamReader::addData(const char *data, qsizetype len) +{ + if (!d->device) { + if (len > 0) + d->buffer.append(data, len); + reparse(); + } else { + qWarning("QCborStreamReader: addData() with device()"); + } +} + +/*! + Reparses the current element. This function must be called when more data + becomes available in the source QIODevice after parsing failed due to + reaching the end of the input data before the end of the CBOR stream. + + When reading from QByteArray(), the addData() function automatically calls + this function. Calling it when the reading had not failed is a no-op. + */ +void QCborStreamReader::reparse() +{ + d->lastError = {}; + d->preread(); + if (CborError err = cbor_value_reparse(&d->currentElement)) + d->handleError(err); + else + preparse(); +} + +/*! + Clears the decoder state and resets the input source data to an empty byte + array. After this function is called, QCborStreamReader will be indicating + an error parsing. + + Call addData() to add more data to be parsed. + + \sa reset(), setDevice() + */ +void QCborStreamReader::clear() +{ + setDevice(nullptr); +} + +/*! + Resets the source back to the beginning and clears the decoder state. If the + source data was a QByteArray, QCborStreamReader will restart from the + beginning of the array. + + If the source data is a QIODevice, this function will call + QIODevice::reset(), which will seek to byte position 0. If the CBOR stream + is not found at the beginning of the device (e.g., beginning of a file), + then this function will likely do the wrong thing. Instead, position the + QIODevice to the right offset and call setDevice(). + + \sa clear(), setDevice() + */ +void QCborStreamReader::reset() +{ + if (d->device) + d->device->reset(); + d->lastError = {}; + d->initDecoder(); + preparse(); +} + +/*! + Returns the last error in decoding the stream, if any. If no error + was encountered, this returns an QCborError::NoError. + + \sa isValid() + */ +QCborError QCborStreamReader::lastError() +{ + return d->lastError; +} + +/*! + Returns the offset in the input stream of the item currently being decoded. + The current offset is the number of decoded bytes so far only if the source + data is a QByteArray or it is a QIODevice that was positioned at its + beginning when decoding started. + + \sa reset(), clear(), device() + */ +qint64 QCborStreamReader::currentOffset() const +{ + return (d->device ? d->device->pos() : 0) + d->bufferStart; +} + +/*! + Returns the number of containers that this stream has entered with + enterContainer() but not yet left. + + \sa enterContainer(), leaveContainer() + */ +int QCborStreamReader::containerDepth() const +{ + return d->containerStack.size(); +} + +/*! + Returns either QCborStreamReader::Array or QCborStreamReader::Map, + indicating whether the container that contains the current item was an array + or map, respectively. If we're currently parsing the root element, this + function returns QCborStreamReader::Invalid. + + \sa containerDepth(), enterContainer() + */ +QCborStreamReader::Type QCborStreamReader::parentContainerType() const +{ + if (d->containerStack.isEmpty()) + return Invalid; + return Type(cbor_value_get_type(&qAsConst(d->containerStack).top())); +} + +/*! + Returns true if there are more items to be decoded in the current container + or false of we've reached its end. If we're parsing the root element, + hasNext() returning false indicates the parsing is complete; otherwise, if + the container depth is non-zero, then the outer code needs to call + leaveContainer(). + + \sa parentContainerType(), containerDepth(), leaveContainer() + */ +bool QCborStreamReader::hasNext() const noexcept +{ + return cbor_value_is_valid(&d->currentElement) && + !cbor_value_at_end(&d->currentElement); +} + +/*! + Advance the CBOR stream decoding one element. You should usually call this + function when parsing fixed-width basic elements (that is, integers, simple + values, tags and floating point values). But this function can be called + when the current item is a string, array or map too and it will skip over + that entire element, including all contained elements. + + This function returns true if advancing was successful, false otherwise. It + may fail if the stream is corrupt, incomplete or if the nesting level of + arrays and maps exceeds \a maxRecursion. Calling this function when + hasNext() has returned false is also an error. If this function returns + false, lastError() will return the error code detailing what the failure + was. + + \sa lastError(), isValid(), hasNext() + */ +bool QCborStreamReader::next(int maxRecursion) +{ + if (lastError() != QCborError::NoError) + return false; + + if (!hasNext()) { + d->handleError(CborErrorAdvancePastEOF); + } else if (maxRecursion < 0) { + d->handleError(CborErrorNestingTooDeep); + } else if (isContainer()) { + // iterate over each element + enterContainer(); + while (lastError() == QCborError::NoError && hasNext()) + next(maxRecursion - 1); + if (lastError() == QCborError::NoError) + leaveContainer(); + } else if (isString() || isByteArray()) { + auto r = _readByteArray_helper(); + while (r.status == Ok) { + if (isString() && !QUtf8::isValidUtf8(r.data, r.data.size()).isValidUtf8) { + d->handleError(CborErrorInvalidUtf8TextString); + break; + } + r = _readByteArray_helper(); + } + } else { + // fixed types + CborError err = cbor_value_advance_fixed(&d->currentElement); + if (err) + d->handleError(err); + } + + preparse(); + return d->lastError == QCborError::NoError; +} + +/*! + Returns true if the length of the current array, map, byte array or string + is known (explicit in the CBOR stream), false otherwise. This function + should only be called if the element is one of those. + + If the length is known, it may be obtained by calling length(). + + If the length of a map or an array is not known, it is implied by the number + of elements present in the stream. QCborStreamReader has no API to calculate + the length in that condition. + + Strings and byte arrays may also have indeterminate length (that is, they + may be transmitted in multiple chunks). Those cannot currently be created + with QCborStreamWriter, but they could be with other encoders, so + QCborStreamReader supports them. + + \sa length(), QCborStreamWriter::startArray(), QCborStreamWriter::startMap() + */ +bool QCborStreamReader::isLengthKnown() const noexcept +{ + return cbor_value_is_length_known(&d->currentElement); +} + +/*! + Returns the length of the string or byte array, or the number of items in an + array or the number, of item pairs in a map, if known. This function must + not be called if the length is unknown (that is, if isLengthKnown() returned + false). It is an error to do that and it will cause QCborStreamReader to + stop parsing the input stream. + + \sa isLengthKnown(), QCborStreamWriter::startArray(), QCborStreamWriter::startMap() + */ +quint64 QCborStreamReader::length() const +{ + CborError err; + switch (type()) { + case String: + case ByteArray: + case Map: + case Array: + if (isLengthKnown()) + return value64; + err = CborErrorUnknownLength; + break; + + default: + err = CborErrorIllegalType; + break; + } + + d->handleError(err); + return quint64(-1); +} + +/*! + \fn bool QCborStreamReader::enterContainer() + + Enters the array or map that is the current item and prepares for iterating + the elements contained in the container. Returns true if entering the + container succeeded, false otherwise (usually, a parsing error). Each call + to enterContainer() must be paired with a call to leaveContainer(). + + This function may only be called if the current item is an array or a map + (that is, if isArray(), isMap() or isContainer() is true). Calling it in any + other condition is an error. + + \sa leaveContainer(), isContainer(), isArray(), isMap() + */ +bool QCborStreamReader::_enterContainer_helper() +{ + d->containerStack.push(d->currentElement); + CborError err = cbor_value_enter_container(&d->containerStack.top(), &d->currentElement); + if (!err) { + preparse(); + return true; + } + d->handleError(err); + return false; +} + +/*! + Leaves the array or map whose items were being processed and positions the + decoder at the next item after the end of the container. Returns true if + leaving the container succeeded, false otherwise (usually, a parsing error). + Each call to enterContainer() must be paired with a call to + leaveContainer(). + + This function may only be called if hasNext() has returned false and + containerDepth() is not zero. Calling it in any other condition is an error. + + \sa enterContainer(), parentContainerType(), containerDepth() + */ +bool QCborStreamReader::leaveContainer() +{ + if (d->containerStack.isEmpty()) { + qWarning("QCborStreamReader::leaveContainer: trying to leave top-level element"); + return false; + } + if (d->corrupt) + return false; + + CborValue container = d->containerStack.pop(); + CborError err = cbor_value_leave_container(&container, &d->currentElement); + d->currentElement = container; + if (err) { + d->handleError(err); + return false; + } + + preparse(); + return true; +} + +/*! + \fn bool QCborStreamReader::toBool() const + + Returns the boolean value of the current element. + + This function does not perform any type conversions, including from integer. + Therefore, it may only be called if isTrue(), isFalse() or isBool() returned + true; calling it in any other condition is an error. + + \sa isBool(), isTrue(), isFalse(), toInteger() + */ + +/*! + \fn QCborTag QCborStreamReader::toTag() const + + Returns the tag value of the current element. + + This function does not perform any type conversions, including from integer. + Therefore, it may only be called if isTag() is true; calling it in any other + condition is an error. + + Tags are 64-bit numbers attached to generic CBOR types that give them + further meaning. For a list of known tags, see the \l QCborKnownTags + enumeration. + + \sa isTag(), toInteger(), QCborKnownTags + */ + +/*! + \fn quint64 QCborStreamReader::toUnsignedInteger() const + + Returns the unsigned integer value of the current element. + + This function does not perform any type conversions, including from boolean + or CBOR tag. Therefore, it may only be called if isUnsignedInteger() is + true; calling it in any other condition is an error. + + This function may be used to obtain numbers beyond the range of the return + type of toInteger(). + + \sa type(), toInteger(), isUnsignedInteger(), isNegativeInteger() + */ + +/*! + \fn QCborNegativeValue QCborStreamReader::toNegativeInteger() const + + Returns the negative integer value of the current element. + QCborNegativeValue is a 64-bit unsigned integer containing the absolute + value of the negative number that was stored in the CBOR stream. + Additionally, QCborNegativeValue(0) represents the number -2\sup{64}. + + This function does not perform any type conversions, including from boolean + or CBOR tag. Therefore, it may only be called if isNegativeInteger() is + true; calling it in any other condition is an error. + + This function may be used to obtain numbers beyond the range of the return + type of toInteger(). However, use of negative numbers smaller than -2\sup{63} + is extremely discouraged. + + \sa type(), toInteger(), isNegativeInteger(), isUnsignedInteger() + */ + +/*! + \fn qint64 QCborStreamReader::toInteger() const + + Returns the integer value of the current element, be it negative, positive + or zero. If the value is larger than 2\sup{63} - 1 or smaller than + -2\sup{63}, the returned value will overflow and will have an incorrect + sign. If handling those values is required, use toUnsignedInteger() or + toNegativeInteger() instead. + + This function does not perform any type conversions, including from boolean + or CBOR tag. Therefore, it may only be called if isInteger() is true; + calling it in any other condition is an error. + + \sa isInteger(), toUnsignedInteger(), toNegativeInteger() + */ + +/*! + \fn QCborSimpleType QCborStreamReader::toSimpleType() const + + Returns value of the current simple type. + + This function does not perform any type conversions, including from integer. + Therefore, it may only be called if isSimpleType() is true; calling it in + any other condition is an error. + + \sa isSimpleType(), isTrue(), isFalse(), isBool(), isNull(), isUndefined() + */ + +/*! + \fn qfloat16 QCborStreamReader::toFloat16() const + + Returns the 16-bit half-precision floating point value of the current element. + + This function does not perform any type conversions, including from other + floating point types or from integer values. Therefore, it may only be + called if isFloat16() is true; calling it in any other condition is an + error. + + \sa isFloat16(), toFloat(), toDouble() + */ + +/*! + \fn float QCborStreamReader::toFloat() const + + Returns the 32-bit single-precision floating point value of the current + element. + + This function does not perform any type conversions, including from other + floating point types or from integer values. Therefore, it may only be + called if isFloat() is true; calling it in any other condition is an error. + + \sa isFloat(), toFloat16(), toDouble() + */ + +/*! + \fn double QCborStreamReader::toDouble() const + + Returns the 64-bit double-precision floating point value of the current + element. + + This function does not perform any type conversions, including from other + floating point types or from integer values. Therefore, it may only be + called if isDouble() is true; calling it in any other condition is an error. + + \sa isDouble(), toFloat16(), toFloat() + */ + +/*! + \fn QCborStreamReader::StringResult QCborStreamReader::readString() + + Decodes one string chunk from the CBOR string and returns it. This function + is used for both regular and chunked string contents, so the caller must + always loop around calling this function, even if isLengthKnown() has + is true. The typical use of this function is as follows: + + \snippet code/src_corelib_serialization_qcborstream.cpp 27 + + This function does not perform any type conversions, including from integers + or from byte arrays. Therefore, it may only be called if isString() returned + true; calling it in any other condition is an error. + + \sa readByteArray(), isString(), readStringChunk() + */ +QCborStreamReader::StringResult QCborStreamReader::_readString_helper() +{ + auto r = _readByteArray_helper(); + QCborStreamReader::StringResult result; + result.status = r.status; + + if (r.status == Ok) { + QTextCodec::ConverterState cs; + result.data = QUtf8::convertToUnicode(r.data, r.data.size(), &cs); + if (cs.invalidChars == 0 && cs.remainingChars == 0) + return result; + + d->handleError(CborErrorInvalidUtf8TextString); + result.data.clear(); + result.status = Error; + return result; + } + return result; +} + +/*! + \fn QCborStreamReader::StringResult QCborStreamReader::readByteArray() + + Decodes one byte array chunk from the CBOR string and returns it. This + function is used for both regular and chunked contents, so the caller must + always loop around calling this function, even if isLengthKnown() has + is true. The typical use of this function is as follows: + + \snippet code/src_corelib_serialization_qcborstream.cpp 28 + + This function does not perform any type conversions, including from integers + or from strings. Therefore, it may only be called if isByteArray() is true; + calling it in any other condition is an error. + + \sa readString(), isByteArray(), readStringChunk() + */ +QCborStreamReader::StringResult QCborStreamReader::_readByteArray_helper() +{ + QCborStreamReader::StringResult result; + result.status = Error; + qsizetype len = _currentStringChunkSize(); + if (len < 0) + return result; + + result.data.resize(len); + auto r = readStringChunk(result.data.data(), len); + Q_ASSERT(r.status != Ok || r.data == len); + result.status = r.status; + return result; +} + +/*! + \fn qsizetype QCborStreamReader::currentStringChunkSize() const + + Returns the size of the current text or byte string chunk. If the CBOR + stream contains a non-chunked string (that is, if isLengthKnown() returns + \c true), this function returns the size of the entire string, the same as + length(). + + This function is useful to pre-allocate the buffer whose pointer can be passed + to readStringChunk() later. + + \sa readString(), readByteArray(), readStringChunk() + */ +qsizetype QCborStreamReader::_currentStringChunkSize() const +{ + if (!d->ensureStringIteration()) + return -1; + + size_t len; + CborError err = cbor_value_get_string_chunk_size(&d->currentElement, &len); + if (err == CborErrorNoMoreStringChunks) + return 0; // not a real error + else if (err) + d->handleError(err); + else if (qsizetype(len) < 0) + d->handleError(CborErrorDataTooLarge); + else + return qsizetype(len); + return -1; +} + +/*! + Reads the current string chunk into the buffer pointed to by \a ptr, whose + size is \a maxlen. This function returns a \l StringResult object, with the + number of bytes copied into \a ptr saved in the \c \l StringResult::data + member. The \c \l StringResult::status member indicates whether there was + an error reading the string, whether data was copied or whether this was + the last chunk. + + This function can be called for both \l String and \l ByteArray types. + For the latter, this function will read the same data that readByteArray() + would have returned. For strings, it returns the UTF-8 equivalent of the \l + QString that would have been returned. + + This function is usually used alongside currentStringChunkSize() in a loop. + For example: + + \snippet code/src_corelib_serialization_qcborstream.cpp 29 + + Unlike readByteArray() and readString(), this function is not limited by + implementation limits of QByteArray and QString. + + \note This function does not perform verification that the UTF-8 contents + are properly formatted. That means this function does not produce the + QCborError::InvalidUtf8String error, even when readString() does. + + \sa currentStringChunkSize(), readString(), readByteArray(), + isString(), isByteArray() + */ +QCborStreamReader::StringResult +QCborStreamReader::readStringChunk(char *ptr, qsizetype maxlen) +{ + CborError err; + size_t len; + const void *content = nullptr; + QCborStreamReader::StringResult result; + result.data = 0; + result.status = Error; + + d->lastError = {}; + if (!d->ensureStringIteration()) + return result; + +#if 1 + // Using internal TinyCBOR API! + err = _cbor_value_get_string_chunk(&d->currentElement, &content, &len, &d->currentElement); +#else + // the above is effectively the same as: + if (cbor_value_is_byte_string(¤tElement)) + err = cbor_value_get_byte_string_chunk(&d->currentElement, reinterpret_cast(&content), + &len, &d->currentElement); + else + err = cbor_value_get_text_string_chunk(&d->currentElement, reinterpret_cast(&content), + &len, &d->currentElement); +#endif + + // Range check: using implementation-defined behavior in converting an + // unsigned value out of range of the destination signed type (same as + // "len > size_t(std::numeric_limits::max())", but generates + // better code with ICC and MSVC). + if (!err && qsizetype(len) < 0) + err = CborErrorDataTooLarge; + + if (err) { + if (err == CborErrorNoMoreStringChunks) { + d->preread(); + err = cbor_value_finish_string_iteration(&d->currentElement); + result.status = EndOfString; + } + if (err) + d->handleError(err); + else + preparse(); + return result; + } + + // Read the chunk into the user's buffer. + qint64 actuallyRead; + qptrdiff offset = qptrdiff(content); + qsizetype toRead = qsizetype(len); + qsizetype left = toRead - maxlen; + if (left < 0) + left = 0; // buffer bigger than string + else + toRead = maxlen; // buffer smaller than string + + if (d->device) { + // This first skip can't fail because we've already read this many bytes. + d->device->skip(d->bufferStart + qptrdiff(content)); + actuallyRead = d->device->read(ptr, toRead); + + if (actuallyRead != toRead) { + actuallyRead = -1; + } else if (left) { + qint64 skipped = d->device->skip(left); + if (skipped != left) + actuallyRead = -1; + } + + if (actuallyRead < 0) { + d->handleError(CborErrorIO); + return result; + } + + d->updateBufferAfterString(offset, len); + } else { + actuallyRead = toRead; + memcpy(ptr, d->buffer.constData() + d->bufferStart + offset, toRead); + d->bufferStart += QByteArray::size_type(offset + len); + } + + d->preread(); + result.data = actuallyRead; + result.status = Ok; + return result; +} + +QT_END_NAMESPACE + +#include "moc_qcborstreamreader.cpp" diff --git a/src/corelib/serialization/qcborstreamreader.h b/src/corelib/serialization/qcborstreamreader.h new file mode 100644 index 0000000000..6d5feccfcf --- /dev/null +++ b/src/corelib/serialization/qcborstreamreader.h @@ -0,0 +1,210 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCBORSTREAMREADER_H +#define QCBORSTREAMREADER_H + +#include +#include +#include +#include +#include +#include + +QT_REQUIRE_CONFIG(cborstreamreader); + +// See qcborcommon.h for why we check +#if defined(QT_X11_DEFINES_FOUND) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QCborStreamReaderPrivate; +class Q_CORE_EXPORT QCborStreamReader +{ + Q_GADGET +public: + enum Type : quint8 { + UnsignedInteger = 0x00, + NegativeInteger = 0x20, + ByteString = 0x40, + ByteArray = ByteString, + TextString = 0x60, + String = TextString, + Array = 0x80, + Map = 0xa0, + Tag = 0xc0, + SimpleType = 0xe0, + HalfFloat = 0xf9, + Float16 = HalfFloat, + Float = 0xfa, + Double = 0xfb, + + Invalid = 0xff + }; + Q_ENUM(Type) + + enum StringResultCode { + EndOfString = 0, + Ok = 1, + Error = -1 + }; + template struct StringResult { + Container data; + StringResultCode status = Error; + }; + Q_ENUM(StringResultCode) + + QCborStreamReader(); + QCborStreamReader(const char *data, qsizetype len); + QCborStreamReader(const quint8 *data, qsizetype len); + explicit QCborStreamReader(const QByteArray &data); + explicit QCborStreamReader(QIODevice *device); + ~QCborStreamReader(); + Q_DISABLE_COPY(QCborStreamReader) + + void setDevice(QIODevice *device); + QIODevice *device() const; + void addData(const QByteArray &data); + void addData(const char *data, qsizetype len); + void addData(const quint8 *data, qsizetype len) + { addData(reinterpret_cast(data), len); } + void reparse(); + void clear(); + void reset(); + + QCborError lastError(); + + qint64 currentOffset() const; + + bool isValid() const { return !isInvalid(); } + + int containerDepth() const; + QCborStreamReader::Type parentContainerType() const; + bool hasNext() const noexcept Q_DECL_PURE_FUNCTION; + bool next(int maxRecursion = 10000); + + Type type() const { return QCborStreamReader::Type(type_); } + bool isUnsignedInteger() const { return type() == UnsignedInteger; } + bool isNegativeInteger() const { return type() == NegativeInteger; } + bool isInteger() const { return quint8(type()) <= quint8(NegativeInteger); } + bool isByteArray() const { return type() == ByteArray; } + bool isString() const { return type() == String; } + bool isArray() const { return type() == Array; } + bool isMap() const { return type() == Map; } + bool isTag() const { return type() == Tag; } + bool isSimpleType() const { return type() == SimpleType; } + bool isFloat16() const { return type() == Float16; } + bool isFloat() const { return type() == Float; } + bool isDouble() const { return type() == Double; } + bool isInvalid() const { return type() == Invalid; } + + bool isSimpleType(QCborSimpleType st) const { return isSimpleType() && toSimpleType() == st; } + bool isFalse() const { return isSimpleType(QCborSimpleType::False); } + bool isTrue() const { return isSimpleType(QCborSimpleType::True); } + bool isBool() const { return isFalse() || isTrue(); } + bool isNull() const { return isSimpleType(QCborSimpleType::Null); } + bool isUndefined() const { return isSimpleType(QCborSimpleType::Undefined); } + + bool isLengthKnown() const noexcept Q_DECL_PURE_FUNCTION; + quint64 length() const; + + bool isContainer() const { return isMap() || isArray(); } + bool enterContainer() { Q_ASSERT(isContainer()); return _enterContainer_helper(); } + bool leaveContainer(); + + StringResult readString() { Q_ASSERT(isString()); return _readString_helper(); } + StringResult readByteArray(){ Q_ASSERT(isByteArray()); return _readByteArray_helper(); } + qsizetype currentStringChunkSize() const{ Q_ASSERT(isString() || isByteArray()); return _currentStringChunkSize(); } + StringResult readStringChunk(char *ptr, qsizetype maxlen); + + bool toBool() const { Q_ASSERT(isBool()); return value64 - int(QCborSimpleType::False); } + QCborTag toTag() const { Q_ASSERT(isTag()); return QCborTag(value64); } + quint64 toUnsignedInteger() const { Q_ASSERT(isUnsignedInteger()); return value64; } + QCborNegativeInteger toNegativeInteger() const { Q_ASSERT(isNegativeInteger()); return QCborNegativeInteger(value64 + 1); } + QCborSimpleType toSimpleType() const{ Q_ASSERT(isSimpleType()); return QCborSimpleType(value64); } + qfloat16 toFloat16() const { Q_ASSERT(isFloat16()); return _toFloatingPoint(); } + float toFloat() const { Q_ASSERT(isFloat()); return _toFloatingPoint(); } + double toDouble() const { Q_ASSERT(isDouble()); return _toFloatingPoint(); } + + qint64 toInteger() const + { + Q_ASSERT(isInteger()); + qint64 v = qint64(value64); + if (isNegativeInteger()) + return -v - 1; + return v; + } + +private: + void preparse(); + bool _enterContainer_helper(); + StringResult _readString_helper(); + StringResult _readByteArray_helper(); + qsizetype _currentStringChunkSize() const; + + template FP _toFloatingPoint() const noexcept + { + using UIntFP = typename QIntegerForSizeof::Unsigned; + UIntFP u = UIntFP(value64); + FP f; + memcpy(static_cast(&f), &u, sizeof(f)); + return f; + } + + friend QCborStreamReaderPrivate; + friend class QCborContainerPrivate; + quint64 value64; + QScopedPointer d; + quint8 type_; + quint8 reserved[3] = {}; +}; + +QT_END_NAMESPACE + +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORSTREAMREADER_H diff --git a/src/corelib/serialization/qcborstreamwriter.cpp b/src/corelib/serialization/qcborstreamwriter.cpp new file mode 100644 index 0000000000..d7f750b05e --- /dev/null +++ b/src/corelib/serialization/qcborstreamwriter.cpp @@ -0,0 +1,868 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qcborstreamwriter.h" + +#define CBOR_NO_PARSER_API +#include + +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +static CborError qt_cbor_encoder_write_callback(void *token, const void *data, size_t len, CborEncoderAppendType); +#define CBOR_ENCODER_WRITER_CONTROL 1 +#define CBOR_ENCODER_WRITE_FUNCTION qt_cbor_encoder_write_callback +#define CBOR_ENCODER_NO_CHECK_USER + +QT_WARNING_PUSH +QT_WARNING_DISABLE_MSVC(4334) // '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) + +#include + +QT_WARNING_POP + +// silence compilers that complain about this being a static function declared +// but never defined +static CborError cbor_encoder_close_container_checked(CborEncoder*, const CborEncoder*) +{ + Q_UNREACHABLE(); + return CborErrorInternalError; +} + +static CborError cbor_encode_float_as_half_float(CborEncoder *, float) +{ + Q_UNREACHABLE(); + return CborErrorInternalError; +} + +Q_DECLARE_TYPEINFO(CborEncoder, Q_PRIMITIVE_TYPE); + +/*! + \class QCborStreamWriter + \inmodule QtCore + \ingroup cbor + \reentrant + \since 5.12 + + \brief The QCborStreamWriter class is a simple CBOR encoder operating on a + one-way stream. + + This class can be used to quickly encode a stream of CBOR content directly + to either a QByteArray or QIODevice. CBOR is the Concise Binary Object + Representation, a very compact form of binary data encoding that is + compatible with JSON. It was created by the IETF Constrained RESTful + Environments (CoRE) WG, which has used it in many new RFCs. It is meant to + be used alongside the \l{https://tools.ietf.org/html/rfc7252}{CoAP + protocol}. + + QCborStreamWriter provides a StAX-like API, similar to that of + \l{QXmlStreamWriter}. It is rather low-level and requires a bit of knowledge + of CBOR encoding. For a simpler API, see \l{QCborValue} and especially the + encoding function QCborValue::toCbor(). + + The typical use of QCborStreamWriter is to create the object on the target + QByteArray or QIODevice, then call one of the append() overloads with the + desired type to be encoded. To create arrays and maps, QCborStreamWriter + provides startArray() and startMap() overloads, which must be terminated by + the corresponding endArray() and endMap() functions. + + The following example encodes the equivalent of this JSON content: + + \div{class="pre"} + { + "label": "journald", + "autoDetect": false, + "condition": "libs.journald", + "output": [ "privateFeature" ] + } + \enddiv + + \snippet code/src_corelib_serialization_qcborstream.cpp 1 + + \section1 CBOR support + + QCborStreamWriter supports all CBOR features required to create canonical + and strict streams. It implements almost all of the features specified in + \l {https://tools.ietf.org/html/rfc7049}{RFC 7049}. + + The following table lists the CBOR features that QCborStreamWriter supports. + + \table + \header \li Feature \li Support + \row \li Unsigned numbers \li Yes (full range) + \row \li Negative numbers \li Yes (full range) + \row \li Byte strings \li Yes + \row \li Text strings \li Yes + \row \li Chunked strings \li No + \row \li Tags \li Yes (arbitrary) + \row \li Booleans \li Yes + \row \li Null \li Yes + \row \li Undefined \li Yes + \row \li Arbitrary simple values \li Yes + \row \li Half-precision float (16-bit) \li Yes + \row \li Single-precision float (32-bit) \li Yes + \row \li Double-precision float (64-bit) \li Yes + \row \li Infinities and NaN floating point \li Yes + \row \li Determinate-length arrays and maps \li Yes + \row \li Indeterminate-length arrays and maps \li Yes + \row \li Map key types other than strings and integers \li Yes (arbitrary) + \endtable + + \section2 Canonical CBOR encoding + + Canonical CBOR encoding is defined by + \l{https://tools.ietf.org/html/rfc7049#section-3.9}{Section 3.9 of RFC + 7049}. Canonical encoding is not a requirement for Qt's CBOR decoding + functionality, but it may be required for some protocols. In particular, + protocols that require the ability to reproduce the same stream identically + may require this. + + In order to be considered "canonical", a CBOR stream must meet the + following requirements: + + \list + \li Integers must be as small as possible. QCborStreamWriter always + does this (no user action is required and it is not possible + to write overlong integers). + \li Array, map and string lengths must be as short as possible. As + above, QCborStreamWriter automatically does this. + \li Arrays, maps and strings must use explicit length. QCborStreamWriter + always does this for strings; for arrays and maps, be sure to call + startArray() and startMap() overloads with explicit length. + \li Keys in every map must be sorted in ascending order. QCborStreamWriter + offers no help in this item: the developer must ensure that before + calling append() for the map pairs. + \li Floating point values should be as small as possible. QCborStreamWriter + will not convert floating point values; it is up to the developer + to perform this check prior to calling append() (see those functions' + examples). + \endlist + + \section2 Strict CBOR mode + + Strict mode is defined by + \l{https://tools.ietf.org/html/rfc7049#section-3.10}{Section 3.10 of RFC + 7049}. As for Canonical encoding above, QCborStreamWriter makes it possible + to create strict CBOR streams, but does not require them or validate that + the output is so. + + \list + \li Keys in a map must be unique. QCborStreamWriter performs no validation + of map keys. + \li Tags may be required to be paired only with the correct types, + according to their specification. QCborStreamWriter performs no + validation of tag usage. + \li Text Strings must be properly-encoded UTF-8. QCborStreamWriter always + writes proper UTF-8 for strings added with append(), but performs no + validation for strings added with appendTextString(). + \endlist + + \section2 Invalid CBOR stream + + It is also possible to misuse QCborStreamWriter and produce invalid CBOR + streams that will fail to be decoded by a receiver. The following actions + will produce invalid streams: + + \list + \li Append a tag and not append the corresponding tagged value + (QCborStreamWriter produces no diagnostic). + \li Append too many or too few items to an array or map with explicit + length (endMap() and endArray() will return false and + QCborStreamWriter will log with qWarning()). + \endlist + + \sa QCborStreamReader, QCborValue, QXmlStreamWriter + */ + +class QCborStreamWriterPrivate +{ +public: + static Q_CONSTEXPR quint64 IndefiniteLength = (std::numeric_limits::max)(); + + QIODevice *device; + CborEncoder encoder; + QStack containerStack; + bool deleteDevice = false; + + QCborStreamWriterPrivate(QIODevice *device) + : device(device) + { + cbor_encoder_init_writer(&encoder, qt_cbor_encoder_write_callback, this); + } + + ~QCborStreamWriterPrivate() + { + if (deleteDevice) + delete device; + } + + template void executeAppend(CborError (*f)(CborEncoder *, Args...), Args... args) + { + f(&encoder, std::forward(args)...); + } + + void createContainer(CborError (*f)(CborEncoder *, CborEncoder *, size_t), quint64 len = IndefiniteLength) + { + Q_STATIC_ASSERT(size_t(IndefiniteLength) == CborIndefiniteLength); + if (sizeof(len) != sizeof(size_t) && len != IndefiniteLength) { + if (Q_UNLIKELY(len >= CborIndefiniteLength)) { + // TinyCBOR can't do this in 32-bit mode + qWarning("QCborStreamWriter: container of size %llu is too big for a 32-bit build; " + "will use indeterminate length instead", len); + len = CborIndefiniteLength; + } + } + + containerStack.push(encoder); + f(&containerStack.top(), &encoder, len); + } + + bool closeContainer() + { + if (containerStack.isEmpty()) { + qWarning("QCborStreamWriter: closing map or array that wasn't open"); + return false; + } + + CborEncoder container = containerStack.pop(); + CborError err = cbor_encoder_close_container(&container, &encoder); + encoder = container; + + if (Q_UNLIKELY(err)) { + if (err == CborErrorTooFewItems) + qWarning("QCborStreamWriter: not enough items added to array or map"); + else if (err == CborErrorTooManyItems) + qWarning("QCborStreamWriter: too many items added to array or map"); + return false; + } + + return true; + } +}; + +static CborError qt_cbor_encoder_write_callback(void *self, const void *data, size_t len, CborEncoderAppendType) +{ + auto that = static_cast(self); + if (!that->device) + return CborNoError; + qint64 written = that->device->write(static_cast(data), len); + return (written == qsizetype(len) ? CborNoError : CborErrorIO); +} + +/*! + Creates a QCborStreamWriter object that will write the stream to \a device. + The device must be opened before the first append() call is made. This + constructor can be used with any class that derives from QIODevice, such as + QFile, QProcess or QTcpSocket. + + QCborStreamWriter has no buffering, so every append() call will result in + one or more calls to the device's \l {QIODevice::}{write()} method. + + The following example writes an empty map to a file: + + \snippet code/src_corelib_serialization_qcborstream.cpp 2 + + QCborStreamWriter does not take ownership of \a device. + + \sa device(), setDevice() + */ +QCborStreamWriter::QCborStreamWriter(QIODevice *device) + : d(new QCborStreamWriterPrivate(device)) +{ +} + +/*! + Creates a QCborStreamWriter object that will append the stream to \a data. + All streaming is done immediately to the byte array, without the need for + flushing any buffers. + + The following example writes a number to a byte array then returns + it. + + \snippet code/src_corelib_serialization_qcborstream.cpp 3 + + QCborStreamWriter does not take ownership of \a data. + */ +QCborStreamWriter::QCborStreamWriter(QByteArray *data) + : d(new QCborStreamWriterPrivate(new QBuffer(data))) +{ + d->deleteDevice = true; + d->device->open(QIODevice::WriteOnly | QIODevice::Unbuffered); +} + +/*! + Destroys this QCborStreamWriter object and frees any resources associated. + + QCborStreamWriter does not perform error checking to see if all required + items were written to the stream prior to the object being destroyed. It is + the programmer's responsibility to ensure that it was done. + */ +QCborStreamWriter::~QCborStreamWriter() +{ +} + +/*! + Replaces the device or byte array that this QCborStreamWriter object is + writing to with \a device. + + \sa device() + */ +void QCborStreamWriter::setDevice(QIODevice *device) +{ + if (d->deleteDevice) + delete d->device; + d->device = device; + d->deleteDevice = false; +} + +/*! + Returns the QIODevice that this QCborStreamWriter object is writing to. The + device must have previously been set with either the constructor or with + setDevice(). + + If this object was created by writing to a QByteArray, this function will + return an internal instance of QBuffer, which is owned by QCborStreamWriter. + + \sa setDevice() + */ +QIODevice *QCborStreamWriter::device() const +{ + return d->device; +} + +/*! + \overload + + Appends the 64-bit unsigned value \a u to the CBOR stream, creating a CBOR + Unsigned Integer value. In the following example, we write the values 0, + 2\sup{32} and \c UINT64_MAX: + + \snippet code/src_corelib_serialization_qcborstream.cpp 4 + + \sa QCborStreamReader::isUnsignedInteger(), QCborStreamReader::toUnsignedInteger() + */ +void QCborStreamWriter::append(quint64 u) +{ + d->executeAppend(cbor_encode_uint, uint64_t(u)); +} + +/*! + \overload + + Appends the 64-bit signed value \a i to the CBOR stream. This will create + either a CBOR Unsigned Integer or CBOR NegativeInteger value based on the + sign of the parameter. In the following example, we write the values 0, -1, + 2\sup{32} and \c INT64_MAX: + + \snippet code/src_corelib_serialization_qcborstream.cpp 5 + + \sa QCborStreamReader::isInteger(), QCborStreamReader::toInteger() + */ +void QCborStreamWriter::append(qint64 i) +{ + d->executeAppend(cbor_encode_int, int64_t(i)); +} + +/*! + \overload + + Appends the 64-bit negative value \a n to the CBOR stream. + QCborNegativeInteger is a 64-bit enum that holds the absolute value of the + negative number we want to write. If n is zero, the value written will be + equivalent to 2\sup{64} (that is, -18,446,744,073,709,551,616). + + In the following example, we write the values -1, -2\sup{32} and INT64_MIN: + \snippet code/src_corelib_serialization_qcborstream.cpp 6 + + Note how this function can be used to encode numbers that cannot fit a + standard computer's 64-bit signed integer like \l qint64. That is, if \a n + is larger than \c{std::numeric_limits::max()} or is 0, this will + represent a negative number smaller than + \c{std::numeric_limits::min()}. + + \sa QCborStreamReader::isNegativeInteger(), QCborStreamReader::toNegativeInteger() + */ +void QCborStreamWriter::append(QCborNegativeInteger n) +{ + d->executeAppend(cbor_encode_negative_int, uint64_t(n)); +} + +/*! + \fn void QCborStreamWriter::append(const QByteArray &ba) + \overload + + Appends the byte array \a ba to the stream, creating a CBOR Byte String + value. QCborStreamWriter will attempt to write the entire string in one + chunk. + + The following example will load and append the contents of a file to the + stream: + + \snippet code/src_corelib_serialization_qcborstream.cpp 7 + + As the example shows, unlike JSON, CBOR requires no escaping for binary + content. + + \sa appendByteString(), QCborStreamReader::isByteArray(), + QCborStreamReader::readByteArray() + */ + +/*! + \overload + + Appends the text string \a str to the stream, creating a CBOR Text String + value. QCborStreamWriter will attempt to write the entire string in one + chunk. + + The following example appends a simple string to the stream: + + \snippet code/src_corelib_serialization_qcborstream.cpp 8 + + \b{Performance note}: CBOR requires that all Text Strings be encoded in + UTF-8, so this function will iterate over the characters in the string to + determine whether the contents are US-ASCII or not. If the string is found + to contain characters outside of US-ASCII, it will allocate memory and + convert to UTF-8. If this check is unnecessary, use appendTextString() + instead. + + \sa QCborStreamReader::isString(), QCborStreamReader::readString() + */ +void QCborStreamWriter::append(QLatin1String str) +{ + // We've got Latin-1 but CBOR wants UTF-8, so check if the string is the + // common subset (US-ASCII). + if (QtPrivate::isAscii(str)) { + // it is plain US-ASCII + appendTextString(str.latin1(), str.size()); + } else { + // non-ASCII, so we need a pass-through UTF-16 + append(QString(str)); + } +} + +/*! + \overload + + Appends the text string \a str to the stream, creating a CBOR Text String + value. QCborStreamWriter will attempt to write the entire string in one + chunk. + + The following example writes an arbitrary QString to the stream: + + \snippet code/src_corelib_serialization_qcborstream.cpp 9 + + \sa QCborStreamReader::isString(), QCborStreamReader::readString() + */ +void QCborStreamWriter::append(QStringView str) +{ + QByteArray utf8 = str.toUtf8(); + appendTextString(utf8.constData(), utf8.size()); +} + +/*! + \overload + + Appends the CBOR tag \a tag to the stream, creating a CBOR Tag value. All + tags must be followed by another type which they provide meaning for. + + In the following example, we append a CBOR Tag 36 (Regular Expression) and a + QRegularExpression's pattern to the stream: + + \snippet code/src_corelib_serialization_qcborstream.cpp 10 + + \sa QCborStreamReader::isTag(), QCborStreamReader::toTag() + */ +void QCborStreamWriter::append(QCborTag tag) +{ + d->executeAppend(cbor_encode_tag, CborTag(tag)); +} + +/*! + \fn void QCborStreamWriter::append(QCborKnownTags tag) + \overload + + Appends the CBOR tag \a tag to the stream, creating a CBOR Tag value. All + tags must be followed by another type which they provide meaning for. + + In the following example, we append a CBOR Tag 1 (Unix \c time_t) and an + integer representing the current time to the stream, obtained using the \c + time() function: + + \snippet code/src_corelib_serialization_qcborstream.cpp 11 + + \sa QCborStreamReader::isTag(), QCborStreamReader::toTag() + */ + +/*! + \overload + + Appends the CBOR simple type \a st to the stream, creating a CBOR Simple + Type value. In the following example, we write the simple type for Null as + well as for type 32, which Qt has no support for. + + \snippet code/src_corelib_serialization_qcborstream.cpp 12 + + \note Using Simple Types for which there is no specification can lead to + validation errors by the remote receiver. In addition, simple type values 24 + through 31 (inclusive) are reserved and must not be used. + + \sa QCborStreamReader::isSimpleType(), QCborStreamReader::toSimpleType() + */ +void QCborStreamWriter::append(QCborSimpleType st) +{ + d->executeAppend(cbor_encode_simple_value, uint8_t(st)); +} + +#ifndef QT_BOOTSTRAPPED +/*! + \overload + + Appends the floating point number \a f to the stream, creating a CBOR 16-bit + Half-Precision Floating Point value. The following code can be used to convert + a C++ \tt float to \c qfloat16 if there's no loss of precision and append it, or + instead append the \tt float. + + \snippet code/src_corelib_serialization_qcborstream.cpp 13 + + \sa QCborStreamReader::isFloat16(), QCborStreamReader::toFloat16() + */ +void QCborStreamWriter::append(qfloat16 f) +{ + d->executeAppend(cbor_encode_half_float, static_cast(&f)); +} +#endif // QT_BOOTSTRAPPED + +/*! + \overload + + Appends the floating point number \a f to the stream, creating a CBOR 32-bit + Single-Precision Floating Point value. The following code can be used to convert + a C++ \tt double to \tt float if there's no loss of precision and append it, or + instead append the \tt double. + + \snippet code/src_corelib_serialization_qcborstream.cpp 14 + + \sa QCborStreamReader::isFloat(), QCborStreamReader::toFloat() + */ +void QCborStreamWriter::append(float f) +{ + d->executeAppend(cbor_encode_float, f); +} + +/*! + \overload + + Appends the floating point number \a d to the stream, creating a CBOR 64-bit + Double-Precision Floating Point value. QCborStreamWriter always appends the + number as-is, performing no check for whether the number is the canonical + form for NaN, an infinite, whether it is denormal or if it could be written + with a shorter format. + + The following code performs all those checks, except for the denormal one, + which is expected to be taken into account by the system FPU or floating + point emulation directly. + + \snippet code/src_corelib_serialization_qcborstream.cpp 15 + + Determining if a double can be converted to an integral with no loss of + precision is left as an exercise to the reader. + + \sa QCborStreamReader::isDouble(), QCborStreamReader::toDouble() + */ +void QCborStreamWriter::append(double d) +{ + this->d->executeAppend(cbor_encode_double, d); +} + +/*! + Appends \a len bytes of data starting from \a data to the stream, creating a + CBOR Byte String value. QCborStreamWriter will attempt to write the entire + string in one chunk. + + Unlike the QByteArray overload of append(), this function is not limited by + QByteArray's size limits. However, note that neither + QCborStreamReader::readByteArray() nor QCborValue support reading CBOR + streams with byte arrays larger than 2 GB. + + \sa append(), appendTextString(), + QCborStreamReader::isByteArray(), QCborStreamReader::readByteArray() + */ +void QCborStreamWriter::appendByteString(const char *data, qsizetype len) +{ + d->executeAppend(cbor_encode_byte_string, reinterpret_cast(data), size_t(len)); +} + +/*! + Appends \a len bytes of text starting from \a utf8 to the stream, creating a + CBOR Text String value. QCborStreamWriter will attempt to write the entire + string in one chunk. + + The string pointed to by \a utf8 is expected to be properly encoded UTF-8. + QCborStreamWriter performs no validation that this is the case. + + Unlike the QLatin1String overload of append(), this function is not limited + to 2 GB. However, note that neither QCborStreamReader::readString() nor + QCborValue support reading CBOR streams with text strings larger than 2 GB. + + \sa append(QLatin1String), append(QStringView), + QCborStreamReader::isString(), QCborStreamReader::readString() + */ +void QCborStreamWriter::appendTextString(const char *utf8, qsizetype len) +{ + d->executeAppend(cbor_encode_text_string, utf8, size_t(len)); +} + +/*! + \fn void QCborStreamWriter::append(const char *str, qsizetype size) + \overload + + Appends \a size bytes of text starting from \a str to the stream, creating a + CBOR Text String value. QCborStreamWriter will attempt to write the entire + string in one chunk. If \a size is -1, this function will write \c strlen(\a + str) bytes. + + The string pointed to by \a str is expected to be properly encoded UTF-8. + QCborStreamWriter performs no validation that this is the case. + + Unlike the QLatin1String overload of append(), this function is not limited + to 2 GB. However, note that neither QCborStreamReader nor QCborValue support + reading CBOR streams with text strings larger than 2 GB. + + \sa append(QLatin1String), append(QStringView), + QCborStreamReader::isString(), QCborStreamReader::readString() + */ + +/*! + \fn void QCborStreamWriter::append(bool b) + \overload + + Appends the boolean value \a b to the stream, creating either a CBOR False + value or a CBOR True value. This function is equivalent to (and implemented + as): + + \snippet code/src_corelib_serialization_qcborstream.cpp 16 + + \sa appendNull(), appendUndefined(), + QCborStreamReader::isBool(), QCborStreamReader::toBool() + */ + +/*! + \fn void QCborStreamWriter::append(std::nullptr_t) + \overload + + Appends a CBOR Null value to the stream. This function is equivalent to (and + implemented as): The parameter is ignored. + + \snippet code/src_corelib_serialization_qcborstream.cpp 17 + + \sa appendNull(), append(QCborSimpleType), QCborStreamReader::isNull() + */ + +/*! + \fn void QCborStreamWriter::appendNull() + + Appends a CBOR Null value to the stream. This function is equivalent to (and + implemented as): + + \snippet code/src_corelib_serialization_qcborstream.cpp 18 + + \sa append(std::nullptr_t), append(QCborSimpleType), QCborStreamReader::isNull() + */ + +/*! + \fn void QCborStreamWriter::appendUndefined() + + Appends a CBOR Undefined value to the stream. This function is equivalent to (and + implemented as): + + \snippet code/src_corelib_serialization_qcborstream.cpp 19 + + \sa append(QCborSimpleType), QCborStreamReader::isUndefined() + */ + +/*! + Starts a CBOR Array with indeterminate length in the CBOR stream. Each + startArray() call must be paired with one endArray() call and the current + CBOR element extends until the end of the array. + + The array created by this function has no explicit length. Instead, its + length is implied by the elements contained in it. Note, however, that use + of indeterminate-length arrays is not compliant with canonical CBOR encoding. + + The following example appends elements from the linked list of strings + passed as input: + + \snippet code/src_corelib_serialization_qcborstream.cpp 20 + + \sa startArray(quint64), endArray(), startMap(), QCborStreamReader::isArray(), + QCborStreamReader::isLengthKnown() + */ +void QCborStreamWriter::startArray() +{ + d->createContainer(cbor_encoder_create_array); +} + +/*! + \overload + + Starts a CBOR Array with explicit length of \a count items in the CBOR + stream. Each startArray call must be paired with one endArray() call and the + current CBOR element extends until the end of the array. + + The array created by this function has an explicit length and therefore + exactly \a count items must be added to the CBOR stream. Adding fewer or + more items will result in failure during endArray() and the CBOR stream will + be corrupt. However, explicit-length arrays are required by canonical CBOR + encoding. + + The following example appends all strings found in the \l QStringList passed as input: + + \snippet code/src_corelib_serialization_qcborstream.cpp 21 + + \b{Size limitations}: The parameter to this function is quint64, which would + seem to allow up to 2\sup{64}-1 elements in the array. However, both + QCborStreamWriter and QCborStreamReader are currently limited to 2\sup{32}-2 + items on 32-bit systems and 2\sup{64}-2 items on 64-bit ones. Also note that + QCborArray is currently limited to 2\sup{27} elements in any platform. + + \sa startArray(), endArray(), startMap(), QCborStreamReader::isArray(), + QCborStreamReader::isLengthKnown() + */ +void QCborStreamWriter::startArray(quint64 count) +{ + d->createContainer(cbor_encoder_create_array, count); +} + +/*! + Terminates the array started by either overload of startArray() and returns + true if the correct number of elements was added to the array. This function + must be called for every startArray() used. + + A return of false indicates error in the application and an unrecoverable + error in this stream. QCborStreamWriter also writes a warning using + qWarning() if that happens. + + Calling this function when the current container is not an array is also an + error, though QCborStreamWriter cannot currently detect this condition. + + \sa startArray(), startArray(quint64), endMap() + */ +bool QCborStreamWriter::endArray() +{ + return d->closeContainer(); +} + +/*! + Starts a CBOR Map with indeterminate length in the CBOR stream. Each + startMap() call must be paired with one endMap() call and the current CBOR + element extends until the end of the map. + + The map created by this function has no explicit length. Instead, its length + is implied by the elements contained in it. Note, however, that use of + indeterminate-length maps is not compliant with canonical CBOR encoding + (canonical encoding also requires keys to be unique and in sorted order). + + The following example appends elements from the linked list of int and + string pairs passed as input: + + \snippet code/src_corelib_serialization_qcborstream.cpp 22 + + \sa startMap(quint64), endMap(), startArray(), QCborStreamReader::isMap(), + QCborStreamReader::isLengthKnown() + */ +void QCborStreamWriter::startMap() +{ + d->createContainer(cbor_encoder_create_map); +} + +/*! + \overload + + Starts a CBOR Map with explicit length of \a count items in the CBOR + stream. Each startMap call must be paired with one endMap() call and the + current CBOR element extends until the end of the map. + + The map created by this function has an explicit length and therefore + exactly \a count pairs of items must be added to the CBOR stream. Adding + fewer or more items will result in failure during endMap() and the CBOR + stream will be corrupt. However, explicit-length map are required by + canonical CBOR encoding. + + The following example appends all strings found in the \l QMap passed as input: + + \snippet code/src_corelib_serialization_qcborstream.cpp 23 + + \b{Size limitations}: The parameter to this function is quint64, which would + seem to allow up to 2\sup{64}-1 pairs in the map. However, both + QCborStreamWriter and QCborStreamReader are currently limited to 2\sup{31}-1 + items on 32-bit systems and 2\sup{63}-1 items on 64-bit ones. Also note that + QCborMap is currently limited to 2\sup{26} elements in any platform. + + \sa startMap(), endMap(), startArray(), QCborStreamReader::isMap(), + QCborStreamReader::isLengthKnown() + */ +void QCborStreamWriter::startMap(quint64 count) +{ + d->createContainer(cbor_encoder_create_map, count); +} + +/*! + Terminates the map started by either overload of startMap() and returns + true if the correct number of elements was added to the array. This function + must be called for every startMap() used. + + A return of false indicates error in the application and an unrecoverable + error in this stream. QCborStreamWriter also writes a warning using + qWarning() if that happens. + + Calling this function when the current container is not a map is also an + error, though QCborStreamWriter cannot currently detect this condition. + + \sa startMap(), startMap(quint64), endArray() + */ +bool QCborStreamWriter::endMap() +{ + return d->closeContainer(); +} + +QT_END_NAMESPACE diff --git a/src/corelib/serialization/qcborstreamwriter.h b/src/corelib/serialization/qcborstreamwriter.h new file mode 100644 index 0000000000..f8c94ceb93 --- /dev/null +++ b/src/corelib/serialization/qcborstreamwriter.h @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2018 Intel Corporation. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QCBORSTREAMWRITER_H +#define QCBORSTREAMWRITER_H + +#include +#include +#include +#include +#include +#ifndef QT_BOOTSTRAPPED +#include +#endif + +QT_REQUIRE_CONFIG(cborstreamwriter); + +// See qcborcommon.h for why we check +#if defined(QT_X11_DEFINES_FOUND) +# undef True +# undef False +#endif + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QCborStreamWriterPrivate; +class Q_CORE_EXPORT QCborStreamWriter +{ +public: + explicit QCborStreamWriter(QIODevice *device); + explicit QCborStreamWriter(QByteArray *data); + ~QCborStreamWriter(); + Q_DISABLE_COPY(QCborStreamWriter) + + void setDevice(QIODevice *device); + QIODevice *device() const; + + void append(quint64 u); + void append(qint64 i); + void append(QCborNegativeInteger n); + void append(const QByteArray &ba) { appendByteString(ba.constData(), ba.size()); } + void append(QLatin1String str); + void append(QStringView str); + void append(QCborTag tag); + void append(QCborKnownTags tag) { append(QCborTag(tag)); } + void append(QCborSimpleType st); + void append(std::nullptr_t) { append(QCborSimpleType::Null); } +#ifndef QT_BOOTSTRAPPED + void append(qfloat16 f); +#endif + void append(float f); + void append(double d); + + void appendByteString(const char *data, qsizetype len); + void appendTextString(const char *utf8, qsizetype len); + + // convenience + void append(bool b) { append(b ? QCborSimpleType::True : QCborSimpleType::False); } + void appendNull() { append(QCborSimpleType::Null); } + void appendUndefined() { append(QCborSimpleType::Undefined); } + +#ifndef Q_QDOC + // overloads to make normal code not complain + void append(int i) { append(qint64(i)); } + void append(uint u) { append(quint64(u)); } +#endif +#ifndef QT_NO_CAST_FROM_ASCII + void append(const char *str, qsizetype size = -1) + { appendTextString(str, (str && size == -1) ? int(strlen(str)) : size); } +#endif + + void startArray(); + void startArray(quint64 count); + bool endArray(); + void startMap(); + void startMap(quint64 count); + bool endMap(); + + // no API for encoding chunked strings + +private: + QScopedPointer d; +}; + +QT_END_NAMESPACE + +#if defined(QT_X11_DEFINES_FOUND) +# define True 1 +# define False 0 +#endif + +#endif // QCBORSTREAMWRITER_H diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 61d61dd9ae..db2840704c 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -43,8 +43,12 @@ #include "qcborarray.h" #include "qcbormap.h" -#if QT_CONFIG(cborstream) -#include "qcborstream.h" +#if QT_CONFIG(cborstreamreader) +#include "qcborstreamreader.h" +#endif + +#if QT_CONFIG(cborstreamwriter) +#include "qcborstreamwriter.h" #endif #include @@ -840,16 +844,20 @@ static QCborValue::Type convertToExtendedType(QCborContainerPrivate *d) return QCborValue::Tag; } -#if QT_CONFIG(cborstream) +#if QT_CONFIG(cborstreamreader) // in qcborstream.cpp extern void qt_cbor_stream_set_error(QCborStreamReaderPrivate *d, QCborError error); +#endif +#if QT_CONFIG(cborstreamwriter) static void writeDoubleToCbor(QCborStreamWriter &writer, double d, QCborValue::EncodingOptions opt) { if (qt_is_nan(d)) { - if (opt & QCborValue::UseFloat16) { + if (opt & QCborValue::UseFloat) { +#ifndef QT_BOOTSTRAPPED if ((opt & QCborValue::UseFloat16) == QCborValue::UseFloat16) return writer.append(std::numeric_limits::quiet_NaN()); +#endif return writer.append(std::numeric_limits::quiet_NaN()); } return writer.append(qt_qnan()); @@ -866,15 +874,17 @@ static void writeDoubleToCbor(QCborStreamWriter &writer, double d, QCborValue::E } } - if (opt & QCborValue::UseFloat16) { + if (opt & QCborValue::UseFloat) { float f = float(d); if (f == d) { // no data loss, we could use float +#ifndef QT_BOOTSTRAPPED if ((opt & QCborValue::UseFloat16) == QCborValue::UseFloat16) { qfloat16 f16 = f; if (f16 == f) return writer.append(f16); } +#endif return writer.append(f); } @@ -882,7 +892,7 @@ static void writeDoubleToCbor(QCborStreamWriter &writer, double d, QCborValue::E writer.append(d); } -#endif // QT_CONFIG(cborstream) +#endif // QT_CONFIG(cborstreamwriter) static inline int typeOrder(Element e1, Element e2) { @@ -1305,7 +1315,7 @@ int QCborMap::compare(const QCborMap &other) const noexcept return compareContainer(d.data(), other.d.data()); } -#if QT_CONFIG(cborstream) +#if QT_CONFIG(cborstreamwriter) static void encodeToCbor(QCborStreamWriter &writer, const QCborContainerPrivate *d, qsizetype idx, QCborValue::EncodingOptions opt) { @@ -1393,7 +1403,9 @@ static void encodeToCbor(QCborStreamWriter &writer, const QCborContainerPrivate qWarning("QCborValue: found unknown type 0x%x", e.type); } } +#endif // QT_CONFIG(cborstreamwriter) +#if QT_CONFIG(cborstreamreader) static inline double integerOutOfRange(const QCborStreamReader &reader) { Q_ASSERT(reader.isInteger()); @@ -1650,7 +1662,7 @@ void QCborContainerPrivate::decodeFromCbor(QCborStreamReader &reader) if (reader.lastError() == QCborError::NoError) reader.leaveContainer(); } -#endif // QT_CONFIG(cborstream) +#endif // QT_CONFIG(cborstreamreader) /*! Creates a QCborValue with byte array value \a ba. The value can later be @@ -2350,7 +2362,7 @@ QCborValueRef QCborValue::operator[](qint64 key) return { container, index }; } -#if QT_CONFIG(cborstream) +#if QT_CONFIG(cborstreamreader) /*! Decodes one item from the CBOR stream found in \a reader and returns the equivalent representation. This function is recursive: if the item is a map @@ -2465,7 +2477,9 @@ QCborValue QCborValue::fromCbor(const QByteArray &ba, QCborParserError *error) overload of this function that accepts a QByteArray, also passing \a error, if provided. */ +#endif // QT_CONFIG(cborstreamreader) +#if QT_CONFIG(cborstreamwriter) /*! Encodes this QCborValue object to its CBOR representation, using the options specified in \a opt, and return the byte array containing that @@ -2588,7 +2602,7 @@ void QCborValueRef::toCbor(QCborStreamWriter &writer, QCborValue::EncodingOption { concrete().toCbor(writer, opt); } -#endif // QT_CONFIG(cborstream) +#endif // QT_CONFIG(cborstreamwriter) void QCborValueRef::assign(QCborValueRef that, const QCborValue &other) { diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h index 071213e83a..1df8425d45 100644 --- a/src/corelib/serialization/qcborvalue.h +++ b/src/corelib/serialization/qcborvalue.h @@ -90,7 +90,9 @@ public: enum EncodingOption { SortKeysInMaps = 0x01, UseFloat = 0x02, +#ifndef QT_BOOTSTRAPPED UseFloat16 = UseFloat | 0x04, +#endif UseIntegers = 0x08, NoTransformation = 0 @@ -287,13 +289,15 @@ public: static QCborValue fromJsonValue(const QJsonValue &v); QJsonValue toJsonValue() const; -#if QT_CONFIG(cborstream) +#if QT_CONFIG(cborstreamreader) static QCborValue fromCbor(QCborStreamReader &reader); static QCborValue fromCbor(const QByteArray &ba, QCborParserError *error = nullptr); static QCborValue fromCbor(const char *data, qsizetype len, QCborParserError *error = nullptr) { return fromCbor(QByteArray(data, int(len)), error); } static QCborValue fromCbor(const quint8 *data, qsizetype len, QCborParserError *error = nullptr) { return fromCbor(QByteArray(reinterpret_cast(data), int(len)), error); } +#endif // QT_CONFIG(cborstreamreader) +#if QT_CONFIG(cborstreamwriter) QByteArray toCbor(EncodingOptions opt = NoTransformation); void toCbor(QCborStreamWriter &writer, EncodingOptions opt = NoTransformation); #endif @@ -441,7 +445,7 @@ public: QVariant toVariant() const { return concrete().toVariant(); } QJsonValue toJsonValue() const; -#if QT_CONFIG(cborstream) +#if QT_CONFIG(cborstreamwriter) QByteArray toCbor(QCborValue::EncodingOptions opt = QCborValue::NoTransformation) { return concrete().toCbor(opt); } void toCbor(QCborStreamWriter &writer, QCborValue::EncodingOptions opt = QCborValue::NoTransformation); diff --git a/src/corelib/serialization/serialization.pri b/src/corelib/serialization/serialization.pri index 7407e20d9e..ff653ca8f3 100644 --- a/src/corelib/serialization/serialization.pri +++ b/src/corelib/serialization/serialization.pri @@ -3,7 +3,9 @@ HEADERS += \ serialization/qcborarray.h \ serialization/qcborcommon.h \ + serialization/qcborcommon_p.h \ serialization/qcbormap.h \ + serialization/qcborstream.h \ serialization/qcborvalue.h \ serialization/qcborvalue_p.h \ serialization/qdatastream.h \ @@ -22,6 +24,7 @@ HEADERS += \ serialization/qxmlutils_p.h SOURCES += \ + serialization/qcborcommon.cpp \ serialization/qcbordiagnostic.cpp \ serialization/qcborvalue.cpp \ serialization/qdatastream.cpp \ @@ -36,12 +39,20 @@ SOURCES += \ serialization/qxmlstream.cpp \ serialization/qxmlutils.cpp -qtConfig(cborstream): { +qtConfig(cborstreamreader): { SOURCES += \ - serialization/qcborstream.cpp + serialization/qcborstreamreader.cpp HEADERS += \ - serialization/qcborstream.h + serialization/qcborstreamreader.h +} + +qtConfig(cborstreamwriter): { + SOURCES += \ + serialization/qcborstreamwriter.cpp + + HEADERS += \ + serialization/qcborstreamwriter.h } qtConfig(binaryjson): { diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 6230cc081d..bfd199a8ba 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -19,6 +19,10 @@ DEFINES += \ QT_NO_FOREACH \ QT_NO_CAST_FROM_ASCII +INCLUDEPATH += \ + $$PWD/.. \ + $$PWD/../../3rdparty/tinycbor/src + SOURCES += \ ../../corelib/codecs/qlatincodec.cpp \ ../../corelib/codecs/qtextcodec.cpp \ @@ -63,6 +67,8 @@ SOURCES += \ ../../corelib/kernel/qsharedmemory.cpp \ ../../corelib/kernel/qsystemsemaphore.cpp \ ../../corelib/plugin/quuid.cpp \ + ../../corelib/serialization/qcborcommon.cpp \ + ../../corelib/serialization/qcborstreamwriter.cpp \ ../../corelib/serialization/qcborvalue.cpp \ ../../corelib/serialization/qdatastream.cpp \ ../../corelib/serialization/qjsoncbor.cpp \ -- cgit v1.2.3 From 4639660dedceba7c16e1a8110bba16eff30be312 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 11 Dec 2019 13:27:49 +0100 Subject: rhi: metal: Skip inactive resources The Quick3D-on-RHI PoC demonstrates a case which the Metal backend fails to handle correctly: have an object with a lighting-enabled material, but remove all lights from the scene. Under the hood this means having a uniform block in the shader, but without referencing it in any way in the actual shader code. This leads to the resource being present (as far as shader reflection is concerned), but with no native binding point available, meaning the attempt to retrieve the Metal binding point for it returns -1, and that is what the QShader carries in the nativeResourceBindingMap. The backend should be prepared to silently skip the resource, whereas currently we end up in an assertion due to attempting to batch the (native) binding "-1", which is invalid. Correct this. Change-Id: I85ee58145f589aca45d46c23e0cdce837d598850 Fixes: QTBUG-80668 Reviewed-by: Paul Olav Tvete --- src/gui/rhi/qrhimetal.mm | 104 +++++++++++++++++++++++++++++++++-------------- src/gui/rhi/qshader.cpp | 7 ++++ 2 files changed, 81 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 3aa68db585..b6ca40e08b 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -673,12 +673,17 @@ static inline int mapBinding(int binding, BindingType type) { const QShader::NativeResourceBindingMap *map = nativeResourceBindingMaps[stageIndex]; - if (map) { - auto it = map->constFind(binding); - if (it != map->cend()) - return type == BindingType::Sampler ? it->second : it->first; - } - return binding; + if (!map) + return binding; // old QShader versions do not have this map, assume 1:1 mapping then + + auto it = map->constFind(binding); + if (it != map->cend()) + return type == BindingType::Sampler ? it->second : it->first; // may be -1, if the resource is inactive + + // Hitting this path is normal too, is not given that the resource (e.g. a + // uniform block) is really present in the shaders for all the stages + // specified by the visibility mask in the QRhiShaderResourceBinding. + return -1; } void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD, @@ -712,16 +717,25 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD } } if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { - res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[VERTEX].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[VERTEX].buffers.feed(nativeBinding, mtlbuf); + res[VERTEX].bufferOffsets.feed(b->binding, offset); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) { - res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[FRAGMENT].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[FRAGMENT].buffers.feed(nativeBinding, mtlbuf); + res[FRAGMENT].bufferOffsets.feed(b->binding, offset); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { - res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[COMPUTE].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[COMPUTE].buffers.feed(nativeBinding, mtlbuf); + res[COMPUTE].bufferOffsets.feed(b->binding, offset); + } } } break; @@ -730,16 +744,28 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.stex.tex); QMetalSampler *samplerD = QRHI_RES(QMetalSampler, b->u.stex.sampler); if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { - res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex); - res[VERTEX].samplers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState); + const int nativeBindingTexture = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture); + const int nativeBindingSampler = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Sampler); + if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) { + res[VERTEX].textures.feed(nativeBindingTexture, texD->d->tex); + res[VERTEX].samplers.feed(nativeBindingSampler, samplerD->d->samplerState); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) { - res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex); - res[FRAGMENT].samplers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState); + const int nativeBindingTexture = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture); + const int nativeBindingSampler = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Sampler); + if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) { + res[FRAGMENT].textures.feed(nativeBindingTexture, texD->d->tex); + res[FRAGMENT].samplers.feed(nativeBindingSampler, samplerD->d->samplerState); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { - res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), texD->d->tex); - res[COMPUTE].samplers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Sampler), samplerD->d->samplerState); + const int nativeBindingTexture = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture); + const int nativeBindingSampler = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Sampler); + if (nativeBindingTexture >= 0 && nativeBindingSampler >= 0) { + res[COMPUTE].textures.feed(nativeBindingTexture, texD->d->tex); + res[COMPUTE].samplers.feed(nativeBindingSampler, samplerD->d->samplerState); + } } } break; @@ -751,12 +777,21 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD { QMetalTexture *texD = QRHI_RES(QMetalTexture, b->u.simage.tex); id t = texD->d->viewForLevel(b->u.simage.level); - if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) - res[VERTEX].textures.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture), t); - if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) - res[FRAGMENT].textures.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture), t); - if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) - res[COMPUTE].textures.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture), t); + if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { + const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Texture); + if (nativeBinding >= 0) + res[VERTEX].textures.feed(nativeBinding, t); + } + if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) { + const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Texture); + if (nativeBinding >= 0) + res[FRAGMENT].textures.feed(nativeBinding, t); + } + if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { + const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Texture); + if (nativeBinding >= 0) + res[COMPUTE].textures.feed(nativeBinding, t); + } } break; case QRhiShaderResourceBinding::BufferLoad: @@ -769,16 +804,25 @@ void QRhiMetal::enqueueShaderResourceBindings(QMetalShaderResourceBindings *srbD id mtlbuf = bufD->d->buf[0]; uint offset = uint(b->u.sbuf.offset); if (b->stage.testFlag(QRhiShaderResourceBinding::VertexStage)) { - res[VERTEX].buffers.feed(mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[VERTEX].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, VERTEX, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[VERTEX].buffers.feed(nativeBinding, mtlbuf); + res[VERTEX].bufferOffsets.feed(b->binding, offset); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::FragmentStage)) { - res[FRAGMENT].buffers.feed(mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[FRAGMENT].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, FRAGMENT, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[FRAGMENT].buffers.feed(nativeBinding, mtlbuf); + res[FRAGMENT].bufferOffsets.feed(b->binding, offset); + } } if (b->stage.testFlag(QRhiShaderResourceBinding::ComputeStage)) { - res[COMPUTE].buffers.feed(mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer), mtlbuf); - res[COMPUTE].bufferOffsets.feed(b->binding, offset); + const int nativeBinding = mapBinding(b->binding, COMPUTE, nativeResourceBindingMaps, BindingType::Buffer); + if (nativeBinding >= 0) { + res[COMPUTE].buffers.feed(nativeBinding, mtlbuf); + res[COMPUTE].bufferOffsets.feed(b->binding, offset); + } } } break; diff --git a/src/gui/rhi/qshader.cpp b/src/gui/rhi/qshader.cpp index dc6060f882..0b99281f08 100644 --- a/src/gui/rhi/qshader.cpp +++ b/src/gui/rhi/qshader.cpp @@ -660,6 +660,13 @@ QDebug operator<<(QDebug dbg, const QShaderVersion &v) pair, because combined image samplers may map to two native resources (a texture and a sampler) in some shading languages. In that case the second value refers to the sampler. + + \note The native binding may be -1, in case there is no active binding for + the resource in the shader. (for example, there is a uniform block + declared, but it is not used in the shader code) The map is always + complete, meaning there is an entry for all declared uniform blocks, + storage blocks, image objects, and combined samplers, but the value will be + -1 for those that are not actually referenced in the shader functions. */ /*! -- cgit v1.2.3 From 83818431e15e36ad9c8484cee33475ba00731d6f Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 11 Dec 2019 14:13:03 +0100 Subject: rhi: gl: Add support for arrays of float, vec2, vec3 and vec4 This is a thing in Qt Quick: there are some types of image particles that use uniforms like "float opacitytable[64]". This should make all views work correctly in the Image Particles example when running on the OpenGL backend of QRhi. (other backends should work as expected already) Change-Id: I64a04fbb98b97d81d257b00b428582e751d46b8e Fixes: QTBUG-80667 Reviewed-by: Paul Olav Tvete --- src/gui/rhi/qrhigles2.cpp | 79 +++++++++++++++++++++++++++++++++++++++------ src/gui/rhi/qrhigles2_p_p.h | 1 + 2 files changed, 70 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 3fb2ec38a7..ffaccbad71 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -2378,12 +2378,23 @@ void QRhiGles2::executeBindGraphicsPipeline(QRhiGraphicsPipeline *ps) f->glUseProgram(psD->program); } +static inline void qrhi_std140_to_packed(float *dst, int vecSize, int elemCount, const void *src) +{ + const float *p = reinterpret_cast(src); + for (int i = 0; i < elemCount; ++i) { + for (int j = 0; j < vecSize; ++j) + dst[vecSize * i + j] = *p++; + p += 4 - vecSize; + } +} + void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs, QRhiShaderResourceBindings *srb, const uint *dynOfsPairs, int dynOfsCount) { QGles2ShaderResourceBindings *srbD = QRHI_RES(QGles2ShaderResourceBindings, srb); int texUnit = 0; + QVarLengthArray packedFloatArray; for (int i = 0, ie = srbD->m_bindings.count(); i != ie; ++i) { const QRhiShaderResourceBinding::Data *b = srbD->m_bindings.at(i).data(); @@ -2411,18 +2422,64 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC // so this should not cause unaligned reads const void *src = bufView.constData() + uniform.offset; + if (uniform.arrayDim > 0 + && uniform.type != QShaderDescription::Float + && uniform.type != QShaderDescription::Vec2 + && uniform.type != QShaderDescription::Vec3 + && uniform.type != QShaderDescription::Vec4) + { + qWarning("Uniform with buffer binding %d, buffer offset %d, type %d is an array, " + "but arrays are only supported for float, vec2, vec3, and vec4. " + "Only the first element will be set.", + uniform.binding, uniform.offset, uniform.type); + } + + // Our input is an std140 layout uniform block. See + // "Standard Uniform Block Layout" in section 7.6.2.2 of + // the OpenGL spec. This has some peculiar alignment + // requirements, which is not what glUniform* wants. Hence + // the unpacking/repacking for arrays and certain types. + switch (uniform.type) { case QShaderDescription::Float: - f->glUniform1f(uniform.glslLocation, *reinterpret_cast(src)); + { + const int elemCount = uniform.arrayDim; + if (elemCount < 1) { + f->glUniform1f(uniform.glslLocation, *reinterpret_cast(src)); + } else { + // input is 16 bytes per element as per std140, have to convert to packed + packedFloatArray.resize(elemCount); + qrhi_std140_to_packed(packedFloatArray.data(), 1, elemCount, src); + f->glUniform1fv(uniform.glslLocation, elemCount, packedFloatArray.constData()); + } + } break; case QShaderDescription::Vec2: - f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast(src)); + { + const int elemCount = uniform.arrayDim; + if (elemCount < 1) { + f->glUniform2fv(uniform.glslLocation, 1, reinterpret_cast(src)); + } else { + packedFloatArray.resize(elemCount * 2); + qrhi_std140_to_packed(packedFloatArray.data(), 2, elemCount, src); + f->glUniform2fv(uniform.glslLocation, elemCount, packedFloatArray.constData()); + } + } break; case QShaderDescription::Vec3: - f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast(src)); + { + const int elemCount = uniform.arrayDim; + if (elemCount < 1) { + f->glUniform3fv(uniform.glslLocation, 1, reinterpret_cast(src)); + } else { + packedFloatArray.resize(elemCount * 3); + qrhi_std140_to_packed(packedFloatArray.data(), 3, elemCount, src); + f->glUniform3fv(uniform.glslLocation, elemCount, packedFloatArray.constData()); + } + } break; case QShaderDescription::Vec4: - f->glUniform4fv(uniform.glslLocation, 1, reinterpret_cast(src)); + f->glUniform4fv(uniform.glslLocation, qMax(1, uniform.arrayDim), reinterpret_cast(src)); break; case QShaderDescription::Mat2: f->glUniformMatrix2fv(uniform.glslLocation, 1, GL_FALSE, reinterpret_cast(src)); @@ -2477,8 +2534,9 @@ void QRhiGles2::bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiC case QShaderDescription::Bool4: f->glUniform4iv(uniform.glslLocation, 1, reinterpret_cast(src)); break; - // ### more types default: + qWarning("Uniform with buffer binding %d, buffer offset %d has unsupported type %d", + uniform.binding, uniform.offset, uniform.type); break; } } @@ -2944,9 +3002,15 @@ void QRhiGles2::registerUniformIfActive(const QShaderDescription::BlockVariable const QByteArray name = namePrefix + var.name.toUtf8(); uniform.glslLocation = f->glGetUniformLocation(program, name.constData()); if (uniform.glslLocation >= 0) { + if (var.arrayDims.count() > 1) { + qWarning("Array '%s' has more than one dimension. This is not supported.", + qPrintable(var.name)); + return; + } uniform.binding = binding; uniform.offset = uint(baseOffset + var.offset); uniform.size = var.size; + uniform.arrayDim = var.arrayDims.isEmpty() ? 0 : var.arrayDims.first(); dst->append(uniform); } } @@ -2979,11 +3043,6 @@ void QRhiGles2::gatherUniforms(GLuint program, } } } else { - if (!blockMember.arrayDims.isEmpty()) { - qWarning("Arrays are only supported for structs at the moment. '%s' ignored.", - qPrintable(blockMember.name)); - continue; - } registerUniformIfActive(blockMember, prefix, ub.binding, 0, program, dst); } } diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index 4a98011d3d..d4f1336c3e 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -252,6 +252,7 @@ struct QGles2UniformDescription int binding; uint offset; int size; + int arrayDim; }; Q_DECLARE_TYPEINFO(QGles2UniformDescription, Q_MOVABLE_TYPE); -- cgit v1.2.3 From 656d6f2a9b221dbd5adfc46262cb243e696d8d62 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Fri, 12 Apr 2019 13:21:44 +0200 Subject: Support Q_GADGET QMetaObject super class hierarchies across templates This patch fixes the QMetaObject::superClass hierarchy for Q_GADGETs that inherit from a template which in turn inherits another Q_GADGET. One common scenario where this is applied is for the CRTP. Without this patch, moc would stop at the template and then sets the superClass QMetaObject to a nullptr. For QObjects this works, since there moc knows that every child must by definition inherit QObject. In order to support this for Q_GADGETs too, we defer the judgment about the availability of a staticMetaObject in the base class to compile time through the existing QtPrivate::MetaObjectForType::value() helper. [ChangeLog][QtCore][moc] Moc now correctly sets a non-null QMetaObject::superClass for Q_GADGETs that inherit from a template which inherits another Q_GADGET. Change-Id: I103b5efd74ed24172dffce477ca2ed6d0f374d44 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/tools/moc/generator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 553e16d472..9029bf9008 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -541,8 +541,10 @@ void Generator::generateCode() if (isQObject) fprintf(out, " nullptr,\n"); - else if (cdef->superclassList.size() && (!cdef->hasQGadget || knownGadgets.contains(purestSuperClass))) + else if (cdef->superclassList.size() && !cdef->hasQGadget) // for qobject, we know the super class must have a static metaobject fprintf(out, " QMetaObject::SuperData::link<%s::staticMetaObject>(),\n", purestSuperClass.constData()); + else if (cdef->superclassList.size()) // for gadgets we need to query at compile time for it + fprintf(out, " QtPrivate::MetaObjectForType<%s>::value(),\n", purestSuperClass.constData()); else fprintf(out, " nullptr,\n"); fprintf(out, " qt_meta_stringdata_%s.data,\n" -- cgit v1.2.3 From c7e35ffe69a73bb144618714313673f0d0c28394 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 26 Nov 2018 09:55:00 +0100 Subject: Use a QMultiHash explicitly if insertMulti() is being used This is a step towards deprecating QHash::insertMulti() and clearly separating QHash and QMultiHash. Change-Id: Ic2c7665673ff00d4f2186e94850710b70330f8ba Reviewed-by: Timur Pocheptsov --- src/tools/moc/generator.cpp | 2 +- src/tools/rcc/rcc.cpp | 6 +++--- src/xml/dom/qdom.cpp | 24 ++++++++++++------------ src/xml/dom/qdom_p.h | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 9029bf9008..034e846918 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -462,7 +462,7 @@ void Generator::generateCode() // Build extra array // QVector extraList; - QHash knownExtraMetaObject = knownGadgets; + QMultiHash knownExtraMetaObject = knownGadgets; knownExtraMetaObject.unite(knownQObjectClasses); for (int i = 0; i < cdef->propertyList.count(); ++i) { diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 7185219d34..7188c81300 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -129,7 +129,7 @@ public: QLocale::Country m_country; QFileInfo m_fileInfo; RCCFileInfo *m_parent; - QHash m_children; + QMultiHash m_children; RCCResourceLibrary::CompressionAlgorithm m_compressAlgo; int m_compressLevel; int m_compressThreshold; @@ -737,7 +737,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) parent->m_children.insert(node, s); parent = s; } else { - parent = parent->m_children[node]; + parent = *parent->m_children.constFind(node); } } @@ -757,7 +757,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) break; } } - parent->m_children.insertMulti(filename, s); + parent->m_children.insert(filename, s); return true; } diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 81f33b0693..cb753ed573 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -2573,8 +2573,8 @@ void QDomNamedNodeMapPrivate::clearMap() QDomNodePrivate* QDomNamedNodeMapPrivate::namedItem(const QString& name) const { - QDomNodePrivate* p = map[name]; - return p; + auto it = map.constFind(name); + return it == map.cend() ? nullptr : *it; } QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, const QString& localName) const @@ -2603,7 +2603,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg) QDomNodePrivate *n = map.value(arg->nodeName()); // We take a reference arg->ref.ref(); - map.insertMulti(arg->nodeName(), arg); + map.insert(arg->nodeName(), arg); return n; } @@ -2620,7 +2620,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg) QDomNodePrivate *n = namedItemNS(arg->namespaceURI, arg->name); // We take a reference arg->ref.ref(); - map.insertMulti(arg->nodeName(), arg); + map.insert(arg->nodeName(), arg); return n; } else { // ### check the following code if it is ok @@ -2963,10 +2963,10 @@ QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, boo while (p) { if (p->isEntity()) // Don't use normal insert function since we would create infinite recursion - entities->map.insertMulti(p->nodeName(), p); + entities->map.insert(p->nodeName(), p); if (p->isNotation()) // Don't use normal insert function since we would create infinite recursion - notations->map.insertMulti(p->nodeName(), p); + notations->map.insert(p->nodeName(), p); p = p->next; } } @@ -3010,9 +3010,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::insertBefore(QDomNodePrivate* newChild QDomNodePrivate* p = QDomNodePrivate::insertBefore(newChild, refChild); // Update the maps if (p && p->isEntity()) - entities->map.insertMulti(p->nodeName(), p); + entities->map.insert(p->nodeName(), p); else if (p && p->isNotation()) - notations->map.insertMulti(p->nodeName(), p); + notations->map.insert(p->nodeName(), p); return p; } @@ -3023,9 +3023,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* p = QDomNodePrivate::insertAfter(newChild, refChild); // Update the maps if (p && p->isEntity()) - entities->map.insertMulti(p->nodeName(), p); + entities->map.insert(p->nodeName(), p); else if (p && p->isNotation()) - notations->map.insertMulti(p->nodeName(), p); + notations->map.insert(p->nodeName(), p); return p; } @@ -3042,9 +3042,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::replaceChild(QDomNodePrivate* newChild notations->map.remove(oldChild->nodeName()); if (p->isEntity()) - entities->map.insertMulti(p->nodeName(), p); + entities->map.insert(p->nodeName(), p); else if (p->isNotation()) - notations->map.insertMulti(p->nodeName(), p); + notations->map.insert(p->nodeName(), p); } return p; diff --git a/src/xml/dom/qdom_p.h b/src/xml/dom/qdom_p.h index d197e999f1..b66c756af0 100644 --- a/src/xml/dom/qdom_p.h +++ b/src/xml/dom/qdom_p.h @@ -235,7 +235,7 @@ public: // Variables QAtomicInt ref; - QHash map; + QMultiHash map; QDomNodePrivate *parent; bool readonly; bool appendToParent; -- cgit v1.2.3 From 9c124b1b0a3730978699b8a6420308b5e5ab4e4e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 26 Nov 2018 10:37:10 +0100 Subject: Qt 6: Deprecate QHash::insertMulti [ChangeLog][QtCore][QHash] insertMulti(), unite() and values(const Key &key) are now deprecated. Please use QMultiHash instead. Change-Id: Ic14907fd5fd38d585708e2dcf2c0200d221ebb25 Reviewed-by: Timur Pocheptsov --- .../doc/snippets/code/src_corelib_tools_qhash.cpp | 16 -- src/corelib/kernel/qvariant.cpp | 2 +- src/corelib/kernel/qvariant.h | 2 +- src/corelib/serialization/qdatastream.h | 3 + src/corelib/tools/qhash.cpp | 102 +++++---- src/corelib/tools/qhash.h | 250 +++++++++++++-------- src/dbus/qdbusargument.h | 2 +- 7 files changed, 217 insertions(+), 160 deletions(-) (limited to 'src') diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp index 9813cc98d5..a140175956 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qhash.cpp @@ -119,22 +119,6 @@ hash.insert("plenty", 2000); //! [9] -//! [10] -QList values = hash.values("plenty"); -for (int i = 0; i < values.size(); ++i) - cout << values.at(i) << Qt::endl; -//! [10] - - -//! [11] -QHash::iterator i = hash.find("plenty"); -while (i != hash.end() && i.key() == "plenty") { - cout << i.value() << Qt::endl; - ++i; -} -//! [11] - - //! [12] QHash hash; ... diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 40a401361d..5e27119729 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -972,7 +972,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) const QVariantMap *map = v_cast(d); const auto end = map->end(); for (auto it = map->begin(); it != end; ++it) - hash->insertMulti(it.key(), it.value()); + static_cast *>(hash)->insert(it.key(), it.value()); #ifndef QT_BOOTSTRAPPED } else if (d->type == QMetaType::QCborValue) { if (!v_cast(d)->isMap()) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index f48419c934..6739643f89 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -825,7 +825,7 @@ namespace QtPrivate { QVariantHash l; l.reserve(iter.size()); for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it) - l.insertMulti(it.key().toString(), it.value()); + static_cast &>(l).insert(it.key().toString(), it.value()); return l; } return QVariantValueHelper::invoke(v); diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h index d9d4a4fcd3..4d827772c8 100644 --- a/src/corelib/serialization/qdatastream.h +++ b/src/corelib/serialization/qdatastream.h @@ -301,7 +301,10 @@ QDataStream &readAssociativeContainer(QDataStream &s, Container &c) c.clear(); break; } +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED c.insertMulti(k, t); +QT_WARNING_POP } return s; diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index dcac91778f..3ff8f886f1 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -1120,21 +1120,6 @@ uint qHash(long double key, uint seed) noexcept \snippet code/src_corelib_tools_qhash.cpp 9 - However, you can store multiple values per key by using - insertMulti() instead of insert() (or using the convenience - subclass QMultiHash). If you want to retrieve all - the values for a single key, you can use values(const Key &key), - which returns a QList: - - \snippet code/src_corelib_tools_qhash.cpp 10 - - The items that share the same key are available from most - recently to least recently inserted. A more efficient approach is - to call find() to get the iterator for the first item with a key - and iterate from there: - - \snippet code/src_corelib_tools_qhash.cpp 11 - If you only need to extract the values from a hash (not the keys), you can also use \l{foreach}: @@ -1435,9 +1420,8 @@ uint qHash(long double key, uint seed) noexcept /*! \fn template int QHash::remove(const Key &key) Removes all the items that have the \a key from the hash. - Returns the number of items removed which is usually 1 but will - be 0 if the key isn't in the hash, or greater than 1 if - insertMulti() has been used with the \a key. + Returns the number of items removed which is 1 if the key exists in the hash, + and 0 otherwise. \sa clear(), take(), QMultiHash::remove() */ @@ -1507,27 +1491,25 @@ uint qHash(long double key, uint seed) noexcept /*! \fn template QList QHash::uniqueKeys() const \since 4.2 + \obsolete Returns a list containing all the keys in the map. Keys that occur multiple times in the map (because items were inserted with insertMulti(), or unite() was used) occur only once in the returned list. - \sa keys(), values() + \sa QMultiHash::uniqueKeys() */ /*! \fn template QList QHash::keys() const Returns a list containing all the keys in the hash, in an arbitrary order. Keys that occur multiple times in the hash - (because items were inserted with insertMulti(), or unite() was - used) also occur multiple times in the list. - - To obtain a list of unique keys, where each key from the map only - occurs once, use uniqueKeys(). + (because the method is operating on a QMultiHash) also occur + multiple times in the list. The order is guaranteed to be the same as that used by values(). - \sa uniqueKeys(), values(), key() + \sa QMultiMap::uniqueKeys(), values(), key() */ /*! \fn template QList QHash::keys(const T &value) const @@ -1555,7 +1537,7 @@ uint qHash(long double key, uint seed) noexcept */ /*! \fn template QList QHash::values(const Key &key) const - + \obsolete \overload Returns a list of all the values associated with the \a key, @@ -1592,6 +1574,7 @@ uint qHash(long double key, uint seed) noexcept */ /*! \fn template int QHash::count(const Key &key) const + \obsolete Returns the number of items associated with the \a key. @@ -1803,8 +1786,6 @@ uint qHash(long double key, uint seed) noexcept If there are multiple items with the \a key, the most recently inserted item's value is replaced with \a value. - - \sa insertMulti() */ /*! \fn template void QHash::insert(const QHash &other) @@ -1820,6 +1801,7 @@ uint qHash(long double key, uint seed) noexcept */ /*! \fn template QHash::iterator QHash::insertMulti(const Key &key, const T &value) + \obsolete Inserts a new item with the \a key and a value of \a value. @@ -1828,16 +1810,17 @@ uint qHash(long double key, uint seed) noexcept different from insert(), which overwrites the value of an existing item.) + This function is obsolete. Use QMultiHash or QMultiMap instead. + \sa insert(), values() */ /*! \fn template QHash &QHash::unite(const QHash &other) + \obsolete Inserts all the items in the \a other hash into this hash. If a key is common to both hashes, the resulting hash will contain the key multiple times. - - \sa insertMulti() */ /*! \fn template bool QHash::empty() const @@ -1978,10 +1961,7 @@ uint qHash(long double key, uint seed) noexcept \snippet code/src_corelib_tools_qhash.cpp 17 Unlike QMap, which orders its items by key, QHash stores its - items in an arbitrary order. The only guarantee is that items that - share the same key (because they were inserted using - QHash::insertMulti()) will appear consecutively, from the most - recently to the least recently inserted value. + items in an arbitrary order. Let's see a few examples of things we can do with a QHash::iterator that we cannot do with a QHash::const_iterator. @@ -2048,7 +2028,7 @@ uint qHash(long double key, uint seed) noexcept There is no direct way of changing an item's key through an iterator, although it can be done by calling QHash::erase() - followed by QHash::insert() or QHash::insertMulti(). + followed by QHash::insert(). \sa value() */ @@ -2210,7 +2190,7 @@ uint qHash(long double key, uint seed) noexcept Unlike QMap, which orders its items by key, QHash stores its items in an arbitrary order. The only guarantee is that items that share the same key (because they were inserted using - QHash::insertMulti()) will appear consecutively, from the most + a QMultiHash) will appear consecutively, from the most recently to the least recently inserted value. Multiple iterators can be used on the same hash. However, be aware @@ -2543,18 +2523,22 @@ uint qHash(long double key, uint seed) noexcept It inherits QHash and extends it with a few convenience functions that make it more suitable than QHash for storing multi-valued hashes. A multi-valued hash is a hash that allows multiple values - with the same key; QHash normally doesn't allow that, unless you - call QHash::insertMulti(). + with the same key. Because QMultiHash inherits QHash, all of QHash's functionality also applies to QMultiHash. For example, you can use isEmpty() to test whether the hash is empty, and you can traverse a QMultiHash using - QHash's iterator classes (for example, QHashIterator). But in - addition, it provides an insert() function that corresponds to - QHash::insertMulti(), and a replace() function that corresponds to + QHash's iterator classes (for example, QHashIterator). But opposed to + QHash, it provides an insert() function will allow the insertion of + multiple items with the same key. The replace() function corresponds to QHash::insert(). It also provides convenient operator+() and operator+=(). + Unlike QMultiMap, QMultiHash does not provide and ordering of the + inserted items. The only guarantee is that items that + share the same key will appear consecutively, from the most + recently to the least recently inserted value. + Example: \snippet code/src_corelib_tools_qhash.cpp 24 @@ -2645,7 +2629,8 @@ uint qHash(long double key, uint seed) noexcept \sa replace() */ -/*! \fn template QMultiHash &QMultiHash::operator+=(const QMultiHash &other) +/*! \fn template QMultiHash &QMultiHash::unite(const QMultiHash &other) + \since 5.13 Inserts all the items in the \a other hash into this hash and returns a reference to this hash. @@ -2653,6 +2638,32 @@ uint qHash(long double key, uint seed) noexcept \sa insert() */ +/*! \fn template QList QHash::uniqueKeys() const + \since 5.13 + + Returns a list containing all the keys in the map. Keys that occur multiple + times in the map occur only once in the returned list. + + \sa keys(), values() +*/ + +/*! \fn template QList QMultiHash::values(const Key &key) const + \overload + + Returns a list of all the values associated with the \a key, + from the most recently inserted to the least recently inserted. + + \sa count(), insert() +*/ + +/*! \fn template QMultiHash &QMultiHash::operator+=(const QMultiHash &other) + + Inserts all the items in the \a other hash into this hash + and returns a reference to this hash. + + \sa unit(), insert() +*/ + /*! \fn template QMultiHash QMultiHash::operator+(const QMultiHash &other) const Returns a hash that contains all the items in this hash in @@ -2682,6 +2693,13 @@ uint qHash(long double key, uint seed) noexcept \sa QHash::remove() */ +/*! \fn template int QMultiHash::count(const Key &key) const + + Returns the number of items associated with the \a key. + + \sa contains(), insert() +*/ + /*! \fn template int QMultiHash::count(const Key &key, const T &value) const \since 4.3 diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 89697b1fd1..0b8a0b283d 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -308,12 +308,14 @@ public: T &operator[](const Key &key); const T operator[](const Key &key) const; - QList uniqueKeys() const; QList keys() const; QList keys(const T &value) const; QList values() const; - QList values(const Key &key) const; - int count(const Key &key) const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QList uniqueKeys() const; + QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QList values(const Key &key) const; + QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") int count(const Key &key) const; +#endif class const_iterator; @@ -388,6 +390,7 @@ public: { friend class iterator; friend class QHash; + friend class QMultiHash; friend class QSet; QHashData::Node *i; @@ -527,8 +530,10 @@ public: const_iterator constFind(const Key &key) const; iterator insert(const Key &key, const T &value); void insert(const QHash &hash); - iterator insertMulti(const Key &key, const T &value); - QHash &unite(const QHash &other); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") iterator insertMulti(const Key &key, const T &value); + QT_DEPRECATED_X("Use QMultiHash for hashes storing multiple values with the same key.") QHash &unite(const QHash &other); +#endif // STL compatibility typedef T mapped_type; @@ -570,6 +575,7 @@ private: #endif } friend class QSet; + friend class QMultiHash; }; @@ -607,38 +613,6 @@ QHash::createNode(uint ah, const Key &akey, const T &avalue, Node **anex return node; } -template -Q_INLINE_TEMPLATE QHash &QHash::unite(const QHash &other) -{ - if (d == &QHashData::shared_null) { - *this = other; - } else { -#if QT_DEPRECATED_SINCE(5, 15) - QHash copy(other); - const_iterator it = copy.constEnd(); - while (it != copy.constBegin()) { - it.i = QHashData::previousNode(it.i); - insertMulti(it.key(), it.value()); - } -#else - QHash copy(other); - const_iterator it = copy.cbegin(); - const const_iterator end = copy.cend(); - while (it != end) { - const auto rangeStart = it++; - while (it != end && rangeStart.key() == it.key()) - ++it; - const qint64 last = std::distance(rangeStart, it) - 1; - for (qint64 i = last; i >= 0; --i) { - auto next = std::next(rangeStart, i); - insertMulti(next.key(), next.value()); - } - } -#endif - } - return *this; -} - template Q_OUTOFLINE_TEMPLATE void QHash::freeData(QHashData *x) { @@ -697,26 +671,6 @@ Q_INLINE_TEMPLATE const T QHash::value(const Key &akey, const T &adefaul } } -template -Q_OUTOFLINE_TEMPLATE QList QHash::uniqueKeys() const -{ - QList res; - res.reserve(size()); // May be too much, but assume short lifetime - const_iterator i = begin(); - if (i != end()) { - for (;;) { - const Key &aKey = i.key(); - res.append(aKey); - do { - if (++i == end()) - goto break_out_of_outer_loop; - } while (aKey == i.key()); - } - } -break_out_of_outer_loop: - return res; -} - template Q_OUTOFLINE_TEMPLATE QList QHash::keys() const { @@ -775,32 +729,6 @@ Q_OUTOFLINE_TEMPLATE QList QHash::values() const return res; } -template -Q_OUTOFLINE_TEMPLATE QList QHash::values(const Key &akey) const -{ - QList res; - Node *node = *findNode(akey); - if (node != e) { - do { - res.append(node->value); - } while ((node = node->next) != e && node->key == akey); - } - return res; -} - -template -Q_OUTOFLINE_TEMPLATE int QHash::count(const Key &akey) const -{ - int cnt = 0; - Node *node = *findNode(akey); - if (node != e) { - do { - ++cnt; - } while ((node = node->next) != e && node->key == akey); - } - return cnt; -} - template Q_INLINE_TEMPLATE const T QHash::operator[](const Key &akey) const { @@ -866,18 +794,6 @@ Q_INLINE_TEMPLATE void QHash::insert(const QHash &hash) } } -template -Q_INLINE_TEMPLATE typename QHash::iterator QHash::insertMulti(const Key &akey, - const T &avalue) -{ - detach(); - d->willGrow(); - - uint h; - Node **nextNode = findNode(akey, &h); - return iterator(createNode(h, akey, avalue, nextNode)); -} - template Q_OUTOFLINE_TEMPLATE int QHash::remove(const Key &akey) { @@ -1128,11 +1044,12 @@ public: inline typename QHash::iterator replace(const Key &key, const T &value) { return QHash::insert(key, value); } - inline typename QHash::iterator insert(const Key &key, const T &value) - { return QHash::insertMulti(key, value); } + typename QHash::iterator insert(const Key &key, const T &value); + + inline QMultiHash &unite(const QMultiHash &other); inline QMultiHash &operator+=(const QMultiHash &other) - { this->unite(other); return *this; } + { return unite(other); } inline QMultiHash operator+(const QMultiHash &other) const { QMultiHash result = *this; result += other; return result; } @@ -1141,13 +1058,27 @@ public: using QHash::count; using QHash::find; using QHash::constFind; + using QHash::values; + using QHash::findNode; + using QHash::createNode; + using QHash::concrete; + using QHash::detach; + + using typename QHash::Node; + using typename QHash::iterator; + using typename QHash::const_iterator; bool contains(const Key &key, const T &value) const; int remove(const Key &key, const T &value); + int count(const Key &key) const; int count(const Key &key, const T &value) const; + QList uniqueKeys() const; + + QList values(const Key &akey) const; + typename QHash::iterator find(const Key &key, const T &value) { typename QHash::iterator i(find(key)); typename QHash::iterator end(this->end()); @@ -1175,6 +1106,50 @@ private: const T operator[](const Key &key) const; }; +template +Q_INLINE_TEMPLATE typename QHash::iterator QMultiHash::insert(const Key &akey, const T &avalue) +{ + detach(); + this->d->willGrow(); + + uint h; + Node **nextNode = findNode(akey, &h); + return iterator(createNode(h, akey, avalue, nextNode)); +} + +template +Q_INLINE_TEMPLATE QMultiHash &QMultiHash::unite(const QMultiHash &other) +{ + if (this->d == &QHashData::shared_null) { + *this = other; + } else { +#if QT_DEPRECATED_SINCE(5, 15) + QMultiHash copy(other); + const_iterator it = copy.constEnd(); + while (it != copy.constBegin()) { + it.i = QHashData::previousNode(it.i); + insert(it.key(), it.value()); + } +#else + const QMultiHash copy(other); + const_iterator it = copy.cbegin(); + const const_iterator end = copy.cend(); + while (it != end) { + const auto rangeStart = it++; + while (it != end && rangeStart.key() == it.key()) + ++it; + const qint64 last = std::distance(rangeStart, it) - 1; + for (qint64 i = last; i >= 0; --i) { + auto next = std::next(rangeStart, i); + insert(next.key(), next.value()); + } + } +#endif + } + return *this; +} + + template Q_INLINE_TEMPLATE bool QMultiHash::contains(const Key &key, const T &value) const { @@ -1212,7 +1187,84 @@ Q_INLINE_TEMPLATE int QMultiHash::count(const Key &key, const T &value) return n; } -template +template +Q_OUTOFLINE_TEMPLATE QList QMultiHash::uniqueKeys() const +{ + QList res; + res.reserve(QHash::size()); // May be too much, but assume short lifetime + typename QHash::const_iterator i = QHash::begin(); + if (i != QHash::end()) { + for (;;) { + const Key &aKey = i.key(); + res.append(aKey); + do { + if (++i == QHash::end()) + goto break_out_of_outer_loop; + } while (aKey == i.key()); + } + } +break_out_of_outer_loop: + return res; +} + +#if QT_DEPRECATED_SINCE(5, 15) + +template +Q_OUTOFLINE_TEMPLATE typename QHash::iterator QHash::insertMulti(const Key &key, const T &value) { + return static_cast *>(this)->insert(key, value); +} + +template +Q_OUTOFLINE_TEMPLATE QHash &QHash::unite(const QHash &other) { + return static_cast *>(this)->unite(other); +} + +template +Q_OUTOFLINE_TEMPLATE QList QHash::values(const Key &akey) const +{ + return static_cast *>(this)->values(akey); +} + +template +Q_OUTOFLINE_TEMPLATE int QHash::count(const Key &akey) const +{ + return static_cast *>(this)->count(akey); +} + +template +Q_OUTOFLINE_TEMPLATE QList QHash::uniqueKeys() const +{ + return static_cast *>(this)->uniqueKeys(); +} +#endif + +template +Q_OUTOFLINE_TEMPLATE QList QMultiHash::values(const Key &akey) const +{ + QList res; + Node *node = *findNode(akey); + if (node != this->e) { + do { + res.append(node->value); + } while ((node = node->next) != this->e && node->key == akey); + } + return res; +} + +template +Q_OUTOFLINE_TEMPLATE int QMultiHash::count(const Key &akey) const +{ + int cnt = 0; + Node *node = *findNode(akey); + if (node != this->e) { + do { + ++cnt; + } while ((node = node->next) != this->e && node->key == akey); + } + return cnt; +} + +template class QHashIterator { typedef typename QHash::const_iterator const_iterator; diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index b7cd4c8989..340f11bf5d 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -370,7 +370,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash & T value; arg.beginMapEntry(); arg >> key >> value; - map.insertMulti(key, value); + static_cast &>(map).insert(key, value); arg.endMapEntry(); } arg.endMap(); -- cgit v1.2.3 From d98a1ef902527ca2351ec6bf18872a4226953487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 6 Nov 2019 18:04:45 +0100 Subject: Add QMap::insert(const QMap &map) As opposed to unite(), this inserts one map into the other without duplicating elements. Task-number: QTBUG-35544 Change-Id: Ie8ab350b29148851a3176cef1007e8a4ca82c273 Reviewed-by: Lars Knoll --- src/corelib/tools/qmap.cpp | 14 ++++++++++++++ src/corelib/tools/qmap.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index a0ec372f9a..970373101f 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -1150,6 +1150,20 @@ void QMapDataBase::freeData(QMapDataBase *d) \sa insertMulti() */ +/*! \fn template void QMap::insert(const QMap &map) + \since 5.15 + + Inserts all the items in \a map into this map. + + If a key is common to both maps, its value will be replaced with + the value stored in \a map. + + \note If \a map contains multiple entries with the same key then the + final value of the key is undefined. + + \sa insertMulti() +*/ + /*! \fn template QMap::iterator QMap::insertMulti(const Key &key, const T &value) Inserts a new item with the key \a key and a value of \a value. diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 18c681581f..fa736e8413 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -578,6 +578,7 @@ public: const_iterator upperBound(const Key &key) const; iterator insert(const Key &key, const T &value); iterator insert(const_iterator pos, const Key &key, const T &value); + void insert(const QMap &map); iterator insertMulti(const Key &key, const T &value); iterator insertMulti(const_iterator pos, const Key &akey, const T &avalue); QMap &unite(const QMap &other); @@ -788,6 +789,49 @@ typename QMap::iterator QMap::insert(const_iterator pos, const K } } +template +Q_INLINE_TEMPLATE void QMap::insert(const QMap &map) +{ + if (d == map.d) + return; + + detach(); + + Node *n = d->root(); + auto it = map.cbegin(); + const auto e = map.cend(); + while (it != e) { + // Insertion here is based on insert(Key, T) + auto parent = d->end(); + bool left = true; + Node *lastNode = nullptr; + while (n) { + parent = n; + if (!qMapLessThanKey(n->key, it.key())) { + lastNode = n; + n = n->leftNode(); + left = true; + } else { + n = n->rightNode(); + left = false; + } + } + if (lastNode && !qMapLessThanKey(it.key(), lastNode->key)) { + lastNode->value = it.value(); + n = lastNode; + } else { + n = d->createNode(it.key(), it.value(), parent, left); + } + ++it; + if (it != e) { + // Move back up the tree until we find the next branch or node which is + // relevant for the next key. + while (n != d->root() && qMapLessThanKey(n->key, it.key())) + n = static_cast(n->parent()); + } + } +} + template Q_INLINE_TEMPLATE typename QMap::iterator QMap::insertMulti(const Key &akey, const T &avalue) -- cgit v1.2.3 From 1c98479aa2d39d099b548e1161e402ad8f05d6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 7 Nov 2019 17:15:50 +0100 Subject: QRegExp: change QMap::unite to QMap::insert Change-Id: I4c682b31da8bfa56c6858a1878f12118568f28bf Reviewed-by: Lars Knoll --- src/corelib/text/qregexp.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qregexp.cpp b/src/corelib/text/qregexp.cpp index ac4d9bbc36..9301a7e573 100644 --- a/src/corelib/text/qregexp.cpp +++ b/src/corelib/text/qregexp.cpp @@ -2528,7 +2528,7 @@ void QRegExpEngine::Box::cat(const Box &b) eng->addCatTransitions(rs, b.ls); addAnchorsToEngine(b); if (minl == 0) { - lanchors.unite(b.lanchors); + lanchors.insert(b.lanchors); if (skipanchors != 0) { for (int i = 0; i < b.ls.size(); i++) { int a = eng->anchorConcatenation(lanchors.value(b.ls.at(i), 0), skipanchors); @@ -2538,7 +2538,7 @@ void QRegExpEngine::Box::cat(const Box &b) mergeInto(&ls, b.ls); } if (b.minl == 0) { - ranchors.unite(b.ranchors); + ranchors.insert(b.ranchors); if (b.skipanchors != 0) { for (int i = 0; i < rs.size(); i++) { int a = eng->anchorConcatenation(ranchors.value(rs.at(i), 0), b.skipanchors); @@ -2596,9 +2596,9 @@ void QRegExpEngine::Box::cat(const Box &b) void QRegExpEngine::Box::orx(const Box &b) { mergeInto(&ls, b.ls); - lanchors.unite(b.lanchors); + lanchors.insert(b.lanchors); mergeInto(&rs, b.rs); - ranchors.unite(b.ranchors); + ranchors.insert(b.ranchors); if (b.minl == 0) { if (minl == 0) -- cgit v1.2.3 From b79d74e96f078580adfd403c8118f1e5429bfb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 7 Nov 2019 17:16:21 +0100 Subject: moc: change QMap::unite to QMap::insert Which is the intended behavior. Change-Id: I0cffc623fc09284f3d95850f840564dca20ed0d4 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/tools/moc/moc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 8cc605fd8a..58c9f88328 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -930,9 +930,9 @@ void Moc::parse() if (it != classList.end()) { it->classInfoList += def.classInfoList; - it->enumDeclarations.unite(def.enumDeclarations); + it->enumDeclarations.insert(def.enumDeclarations); it->enumList += def.enumList; - it->flagAliases.unite(def.flagAliases); + it->flagAliases.insert(def.flagAliases); } else { knownGadgets.insert(def.classname, def.qualified); knownGadgets.insert(def.qualified, def.qualified); -- cgit v1.2.3 From 43837f38b23e46b2b26599b30724902ce6eddabe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 27 Nov 2019 17:13:13 +0100 Subject: Change some uses of QMap::insertMulti to QMultiMap::insert By casting it, these are situations where we cannot change the type itself to QMultiMap. For QVariant it's a public define and for dbus it's the type of an argument to the function. Change-Id: I0f385dc857fce5de3e8254d18268fd84a6d7707c Reviewed-by: Lars Knoll --- src/corelib/kernel/qvariant.cpp | 2 +- src/corelib/kernel/qvariant.h | 2 +- src/dbus/qdbusargument.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 5e27119729..c00efc0afe 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -944,7 +944,7 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) const QVariantHash *hash = v_cast(d); const auto end = hash->end(); for (auto it = hash->begin(); it != end; ++it) - map->insertMulti(it.key(), it.value()); + static_cast *>(map)->insert(it.key(), it.value()); #ifndef QT_BOOTSTRAPPED } else if (d->type == QMetaType::QCborValue) { if (!v_cast(d)->isMap()) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 6739643f89..0dddfc59b3 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -841,7 +841,7 @@ namespace QtPrivate { QAssociativeIterable iter = QVariantValueHelperInterface::invoke(v); QVariantMap l; for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it) - l.insertMulti(it.key().toString(), it.value()); + static_cast &>(l).insert(it.key().toString(), it.value()); return l; } return QVariantValueHelper::invoke(v); diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h index 340f11bf5d..477bd1e8fd 100644 --- a/src/dbus/qdbusargument.h +++ b/src/dbus/qdbusargument.h @@ -321,7 +321,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QMap &m T value; arg.beginMapEntry(); arg >> key >> value; - map.insertMulti(key, value); + static_cast &>(map).insert(key, value); arg.endMapEntry(); } arg.endMap(); -- cgit v1.2.3 From 6f5556e7b4d5d388805d06d852b5cdb7c52e80dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 27 Nov 2019 17:16:50 +0100 Subject: QTextDocument: Change use of QMap::unite to QMap::insert None of the code I could see handles the map like a multimap. Change-Id: I9d51da6dafed4317e801703599e83fb038c22a1d Reviewed-by: Volker Hilsheimer Reviewed-by: Lars Knoll --- src/gui/text/qtextdocument.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 1d27cc30eb..f2caedc25f 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -3085,7 +3085,7 @@ void QTextDocumentPrivate::mergeCachedResources(const QTextDocumentPrivate *priv if (!priv) return; - cachedResources.unite(priv->cachedResources); + cachedResources.insert(priv->cachedResources); } void QTextHtmlExporter::emitBackgroundAttribute(const QTextFormat &format) -- cgit v1.2.3 From 40f28b1a8afbe15da369db53cda3dadd8d11ee43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 29 Nov 2019 12:13:49 +0100 Subject: Don't use QMap::unite for merging maps Other code using these maps are not treating them like multi-maps Change-Id: I3381fde3b3612a29110cfe890f20f96f3c0bd3a2 Reviewed-by: Lars Knoll --- src/dbus/qdbusmetaobject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 74e17ced77..3c529ab755 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -631,10 +631,10 @@ QDBusMetaObject *QDBusMetaObject::createMetaObject(const QString &interface, con QDBusIntrospection::Interface merged = *it.value().constData(); for (++it; it != end; ++it) { - merged.annotations.unite(it.value()->annotations); + merged.annotations.insert(it.value()->annotations); merged.methods.unite(it.value()->methods); merged.signals_.unite(it.value()->signals_); - merged.properties.unite(it.value()->properties); + merged.properties.insert(it.value()->properties); } merged.name = QLatin1String("local.Merged"); -- cgit v1.2.3 From 14071b5a8e15b1f9ce0bf601a96ae365fa8983aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 13:40:50 +0200 Subject: Clarify call to initializeWidgetFontHash in QApplication::setStyle The call was added in c49c96fbb13912, "Reinitialize system palette when setting a new style", but adding it along with the palette code seems like a mistake. The potentially dirty widget font hash needs to be reset for all style changes. Change-Id: I411f56bb833819213c5485d7585fc5e3e9bd8983 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index dfa1bc23b1..b3938df78a 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1133,12 +1133,18 @@ void QApplication::setStyle(QStyle *style) } else if (QApplicationPrivate::sys_pal) { clearSystemPalette(); initSystemPalette(); - QApplicationPrivate::initializeWidgetFontHash(); } else if (!QApplicationPrivate::sys_pal) { // Initialize the sys_pal if it hasn't happened yet... QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); } + // The default widget font hash is based on the platform theme, + // not the style, but the widget fonts could in theory have been + // affected by polish of the previous style, without a proper + // cleanup in unpolish, so reset it now before polishing the + // new style. + QApplicationPrivate::initializeWidgetFontHash(); + // initialize the application with the new style QApplicationPrivate::app_style->polish(qApp); -- cgit v1.2.3 From 6b06f12da6d5171d02764e9d6636c59731e2289f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 13:45:39 +0200 Subject: Unify system palette initialization during style change We let initSystemPalette() do all the work, instead of leaving the first time initialization of the system palette to the caller, which makes the logic harder to follow. This also means first time initialization of the system palette will pick up a platform theme if available and resolve the palette using that, which was missing from the original logic. Change-Id: I84da557caf8ecedf6d96d87ebee93168ea9d73ba Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index b3938df78a..37948ecd8c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -142,16 +142,19 @@ QApplicationPrivate *QApplicationPrivate::self = 0; static void initSystemPalette() { - if (!QApplicationPrivate::sys_pal) { - QPalette defaultPlatte; - if (QApplicationPrivate::app_style) - defaultPlatte = QApplicationPrivate::app_style->standardPalette(); - if (const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette()) { - QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPlatte)); - QApplicationPrivate::initializeWidgetPaletteHash(); - } else { - QApplicationPrivate::setSystemPalette(defaultPlatte); - } + if (QApplicationPrivate::sys_pal) + return; // Already initialized + + QPalette defaultPalette; + if (QApplicationPrivate::app_style) + defaultPalette = QApplicationPrivate::app_style->standardPalette(); + + auto *platformTheme = QGuiApplicationPrivate::platformTheme(); + if (const QPalette *themePalette = platformTheme ? platformTheme->palette() : nullptr) { + QApplicationPrivate::setSystemPalette(themePalette->resolve(defaultPalette)); + QApplicationPrivate::initializeWidgetPaletteHash(); + } else { + QApplicationPrivate::setSystemPalette(defaultPalette); } } @@ -1130,12 +1133,10 @@ void QApplication::setStyle(QStyle *style) // might call QApplication::setPalette() itself if (QApplicationPrivate::set_pal) { QApplication::setPalette(*QApplicationPrivate::set_pal); - } else if (QApplicationPrivate::sys_pal) { - clearSystemPalette(); + } else { + if (QApplicationPrivate::sys_pal) + clearSystemPalette(); initSystemPalette(); - } else if (!QApplicationPrivate::sys_pal) { - // Initialize the sys_pal if it hasn't happened yet... - QApplicationPrivate::setSystemPalette(QApplicationPrivate::app_style->standardPalette()); } // The default widget font hash is based on the platform theme, -- cgit v1.2.3 From f6a2b81eabae81110f678263be8558c24072c458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 14:04:46 +0200 Subject: Update system palette on application init if needed A style may have been set before the application was created, which would have resulted in setting the system palette based on the style's palette. Once the application is initialized and we have a platform theme we need to reset the system palette. Change-Id: Ia48f57d3983535c8633741d8027f75bc0c214018 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 37948ecd8c..f546ec9187 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -555,6 +555,12 @@ void QApplicationPrivate::init() // Must be called before initialize() QColormap::initialize(); + if (sys_pal) { + // Now that we have a platform theme we need to reset + // the system palette to pick up the theme colors. + clearSystemPalette(); + initSystemPalette(); + } qt_init_tooltip_palette(); QApplicationPrivate::initializeWidgetFontHash(); -- cgit v1.2.3 From a9e628e7ec6b9d5bb38e64b7129c68320322033b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 21 Jun 2019 14:17:50 +0200 Subject: Ensure override style properly clears out previous style if set QApplication::setStyle has quite a bit of logic to clean up from the old style before setting a new one. If a style has been set before the application is created, it's not enough to just delete the existing style, we need to treat it like a normal style switch. Change-Id: I2bcc2eb75567bf1bc8a32ac31467b22315a70a0b Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f546ec9187..fc3b73924e 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -434,13 +434,6 @@ void QApplicationPrivate::process_cmdline() if (styleOverride.isEmpty() && qEnvironmentVariableIsSet("QT_STYLE_OVERRIDE")) styleOverride = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE")); - if (!styleOverride.isEmpty()) { - if (app_style) { - delete app_style; - app_style = 0; - } - } - // process platform-indep command line if (!qt_is_gui_used || !argc) return; @@ -606,8 +599,20 @@ void QApplicationPrivate::initialize() // needed for widgets in QML QAbstractDeclarativeData::setWidgetParent = QWidgetPrivate::setWidgetParentHelper; - if (application_type != QApplicationPrivate::Tty) - (void) QApplication::style(); // trigger creation of application style + if (application_type != QApplicationPrivate::Tty) { + if (!styleOverride.isEmpty()) { + if (auto *style = QStyleFactory::create(styleOverride.toLower())) { + QApplication::setStyle(style); + } else { + qWarning("QApplication: invalid style override '%s' passed, ignoring it.\n" + "\tAvailable styles: %s", qPrintable(styleOverride), + qPrintable(QStyleFactory::keys().join(QLatin1String(", ")))); + } + } + + // Trigger default style if none was set already + Q_UNUSED(QApplication::style()); + } #if QT_CONFIG(statemachine) // trigger registering of QStateMachine's GUI types qRegisterGuiStateMachine(); @@ -1036,15 +1041,6 @@ QStyle *QApplication::style() // Compile-time search for default style // QStyle *&app_style = QApplicationPrivate::app_style; - - if (!QApplicationPrivate::styleOverride.isEmpty()) { - const QString style = QApplicationPrivate::styleOverride.toLower(); - app_style = QStyleFactory::create(style); - if (Q_UNLIKELY(!app_style)) { - qWarning("QApplication: invalid style override passed, ignoring it.\n" - " Available styles: %s", qPrintable(QStyleFactory::keys().join(QLatin1String(", ")))); - } - } if (!app_style) app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); -- cgit v1.2.3 From 96d1d44279dc582355c21956fee99d945888fb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 25 Jun 2019 16:02:17 +0200 Subject: Clean up QApplication::style default style construction Change-Id: I9f01e7cc5fa90fd9b1f5d12c7ce694c231158c32 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 49 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index fc3b73924e..1f26e6e41c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1030,46 +1030,45 @@ void QApplication::setStyleSheet(const QString& styleSheet) */ QStyle *QApplication::style() { - if (QApplicationPrivate::app_style) - return QApplicationPrivate::app_style; - if (!qobject_cast(QCoreApplication::instance())) { - Q_ASSERT(!"No style available without QApplication!"); - return 0; - } - if (!QApplicationPrivate::app_style) { - // Compile-time search for default style - // - QStyle *&app_style = QApplicationPrivate::app_style; - if (!app_style) - app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); + // Create default style + if (!qobject_cast(QCoreApplication::instance())) { + Q_ASSERT(!"No style available without QApplication!"); + return nullptr; + } + + auto &defaultStyle = QApplicationPrivate::app_style; - if (!app_style) { + defaultStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); + if (!defaultStyle) { const QStringList styles = QStyleFactory::keys(); for (const auto &style : styles) { - if ((app_style = QStyleFactory::create(style))) + if ((defaultStyle = QStyleFactory::create(style))) break; } } - if (!app_style) { + if (!defaultStyle) { Q_ASSERT(!"No styles available!"); return 0; } - } - // take ownership of the style - QApplicationPrivate::app_style->setParent(qApp); - initSystemPalette(); + // Take ownership of the style + defaultStyle->setParent(qApp); - if (QApplicationPrivate::set_pal) // repolish set palette with the new style - QApplication::setPalette(*QApplicationPrivate::set_pal); + initSystemPalette(); + + if (QApplicationPrivate::set_pal) // Re-polish set palette with the new style + QApplication::setPalette(*QApplicationPrivate::set_pal); #ifndef QT_NO_STYLE_STYLESHEET - if (!QApplicationPrivate::styleSheet.isEmpty()) { - qApp->setStyleSheet(QApplicationPrivate::styleSheet); - } else + if (!QApplicationPrivate::styleSheet.isEmpty()) { + qApp->setStyleSheet(QApplicationPrivate::styleSheet); + } else #endif - QApplicationPrivate::app_style->polish(qApp); + { + defaultStyle->polish(qApp); + } + } return QApplicationPrivate::app_style; } -- cgit v1.2.3 From da0e7457523a5c6867c2d9b9f0346167738f0323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 25 Jun 2019 16:24:33 +0200 Subject: Explicitly polish palette instead of relying on QApplication::setPalette The only effect calling QApplication::setPalette will have is the polish, so opt for doing it explicitly instead of the weirdly looking no-op assignment. Change-Id: Ia80b3f60e3e513b68c2993ea8417966f9ab6721e Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1f26e6e41c..2a1a21596c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1057,8 +1057,8 @@ QStyle *QApplication::style() initSystemPalette(); - if (QApplicationPrivate::set_pal) // Re-polish set palette with the new style - QApplication::setPalette(*QApplicationPrivate::set_pal); + if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) + defaultStyle->polish(*explicitlySetPalette); #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty()) { @@ -1132,8 +1132,8 @@ void QApplication::setStyle(QStyle *style) // take care of possible palette requirements of certain gui // styles. Do it before polishing the application since the style // might call QApplication::setPalette() itself - if (QApplicationPrivate::set_pal) { - QApplication::setPalette(*QApplicationPrivate::set_pal); + if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) { + QApplicationPrivate::app_style->polish(*explicitlySetPalette); } else { if (QApplicationPrivate::sys_pal) clearSystemPalette(); -- cgit v1.2.3 From 1e27db6c20913bf1c8b607f1eb5e899fc8f4112e Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 6 Dec 2019 22:03:35 +0100 Subject: Avoid using a QRegExp for trivial replacements It's slow and we want to get rid of it. In this case, it's just as easy to do the replacing manually using a small loop. Task-number: QTBUG-72587 Change-Id: I32e1cc89642bc0e5b6f500d072960cd8871e0684 Reviewed-by: Friedemann Kleint Reviewed-by: Edward Welbourne --- src/corelib/io/qprocess_win.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 05af5a5aee..1527cf93ed 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -398,7 +397,17 @@ static QString qt_create_commandline(const QString &program, const QStringList & for (int i=0; i= 0) { + // Escape quote + tmp.insert(index++, QLatin1Char('\\')); + // Double preceding backslashes (ignoring the one we just inserted) + for (int i = index - 2 ; i >= 0 && tmp.at(i) == QLatin1Char('\\') ; --i) { + tmp.insert(i, QLatin1Char('\\')); + index++; + } + index = tmp.indexOf(QLatin1Char('"'), index + 1); + } if (tmp.isEmpty() || tmp.contains(QLatin1Char(' ')) || tmp.contains(QLatin1Char('\t'))) { // The argument must not end with a \ since this would be interpreted // as escaping the quote -- rather put the \ behind the quote: e.g. -- cgit v1.2.3 From df69364469c6816dab0f364f0687946a8d566679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 25 Jun 2019 16:53:37 +0200 Subject: Remove QApplicationPrivate::set_pal Its purpose was to track the default palette set by the programmer, but after 8fb881900c this is tracked by the Qt::AA_SetPalette attribute. The palette itself is always reflected 1:1 in the palette tracked by QGuiApplicationPrivate::app_pal. Change-Id: If3e84c8b3ae6070b6c50be7a33adb38799b3f3a5 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 18 ++++++------------ src/widgets/kernel/qapplication_p.h | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 2a1a21596c..5a21a3a15c 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -382,7 +382,6 @@ QString QApplicationPrivate::styleSheet; // default application styles QPointer QApplicationPrivate::leaveAfterRelease = 0; QPalette *QApplicationPrivate::sys_pal = 0; // default system palette -QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer QFont *QApplicationPrivate::sys_font = 0; // default system font QFont *QApplicationPrivate::set_font = 0; // default font set by programmer @@ -803,8 +802,6 @@ QApplication::~QApplication() delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; clearSystemPalette(); - delete QApplicationPrivate::set_pal; - QApplicationPrivate::set_pal = 0; app_palettes()->clear(); delete QApplicationPrivate::sys_font; @@ -1057,8 +1054,8 @@ QStyle *QApplication::style() initSystemPalette(); - if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) - defaultStyle->polish(*explicitlySetPalette); + if (testAttribute(Qt::AA_SetPalette)) + defaultStyle->polish(*QGuiApplicationPrivate::app_pal); #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty()) { @@ -1132,8 +1129,8 @@ void QApplication::setStyle(QStyle *style) // take care of possible palette requirements of certain gui // styles. Do it before polishing the application since the style // might call QApplication::setPalette() itself - if (auto *explicitlySetPalette = QApplicationPrivate::set_pal) { - QApplicationPrivate::app_style->polish(*explicitlySetPalette); + if (testAttribute(Qt::AA_SetPalette)) { + QApplicationPrivate::app_style->polish(*QGuiApplicationPrivate::app_pal); } else { if (QApplicationPrivate::sys_pal) clearSystemPalette(); @@ -1397,11 +1394,8 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* // Send ApplicationPaletteChange to qApp itself, and to the widgets. qApp->d_func()->sendApplicationPaletteChange(all, className); } + if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { - if (!QApplicationPrivate::set_pal) - QApplicationPrivate::set_pal = new QPalette(palette); - else - *QApplicationPrivate::set_pal = palette; QCoreApplication::setAttribute(Qt::AA_SetPalette); emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); } @@ -1444,7 +1438,7 @@ void QApplicationPrivate::setSystemPalette(const QPalette &pal) else *sys_pal = pal; - if (!QApplicationPrivate::set_pal) + if (!testAttribute(Qt::AA_SetPalette)) QApplication::setPalette(*sys_pal); } diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 3167bd423f..79d06ed98c 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -162,7 +162,6 @@ public: static QWidgetList *popupWidgets; static QStyle *app_style; static QPalette *sys_pal; - static QPalette *set_pal; protected: void notifyThemeChanged() override; -- cgit v1.2.3 From 318a991907b6c08f52786160bafea1e30d3ad9bd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 10 Dec 2019 13:57:24 +0100 Subject: Windows: Fix offset of glyphs with DirectWrite font engine When fetching the bounding box of the alphamap for the glyph cache, we would include the margins in the size, but we would not account for it in the origin. We would therefore get a mismatch when copying the alpha map into the cache. [ChangeLog][Windows] Fixed a 2 pixel offset on glyphs when using color fonts or any hinting preference other than the default (full) hinting. Fixes: QTBUG-71928 Change-Id: I9287df02de4f6e79c3b6c5ce92b73c284261ef5c Reviewed-by: Lars Knoll --- .../fontdatabases/windows/qwindowsfontenginedirectwrite.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp index 3415002ffc..98246de0a5 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp @@ -1012,8 +1012,8 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph int margin = glyphMargin(QFontEngine::Format_A32); - return glyph_metrics_t(rect.left, - rect.top, + return glyph_metrics_t(rect.left - margin, + rect.top - margin, rect.right - rect.left + margin * 2, rect.bottom - rect.top + margin * 2, bbox.xoff, bbox.yoff); -- cgit v1.2.3 From a3a6f28427de260ab827fc405b53b6f162f1ec90 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 13 Dec 2019 12:04:14 +0100 Subject: OpenGL: Fix signature of GLDEBUGPROC in qopenglextrafunctions.h The typedef "QOPENGLF_APIENTRYP" was incompatible to the one in "src/opengl/qopengldebug.cpp" which used "QOPENGLF_APIENTRY". Note the misisng "P " ending. The type is meant to be a function pointer, not a pointer to a function pointer, so remove the extra P. Change-Id: I229b73ca8e7367f88a2b48e2728e615605f02da3 Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglextrafunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h index a68e269065..faac2dce4e 100644 --- a/src/gui/opengl/qopenglextrafunctions.h +++ b/src/gui/opengl/qopenglextrafunctions.h @@ -54,7 +54,7 @@ // GLES build without having included gl32.h -> GLDEBUGPROC is still need for the protos, define it here #if defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_3_2) -typedef void (QOPENGLF_APIENTRYP *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +typedef void (QOPENGLF_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); #endif QT_BEGIN_NAMESPACE -- cgit v1.2.3 From e076965542148b8c2341fd4418733febbf9ae1ec Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Fri, 16 Aug 2019 15:38:54 -0400 Subject: Move QQnxGLContext::ms_eglDisplay to the integration object In part, this is a continuation of https://codereview.qt-project.org/c/qt/qtbase/+/227953. It also paves the way toward implementing the EglDisplay integration resource needed by QtWayland. For the code that's being moved around and modified, switch from !QT_NO_OPENGL to QT_CONFIG(opengl). Change-Id: I5046e8caf5df7cf326f8e697d7d41cf802250414 Reviewed-by: Dan Cape Reviewed-by: Samuli Piippo --- src/plugins/platforms/qnx/qqnxglcontext.cpp | 27 ++----------------- src/plugins/platforms/qnx/qqnxglcontext.h | 7 ----- src/plugins/platforms/qnx/qqnxintegration.cpp | 37 ++++++++++++++++++++++----- src/plugins/platforms/qnx/qqnxintegration.h | 13 +++++++++- 4 files changed, 45 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxglcontext.cpp b/src/plugins/platforms/qnx/qqnxglcontext.cpp index 1d030ba1aa..69391c4fec 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.cpp +++ b/src/plugins/platforms/qnx/qqnxglcontext.cpp @@ -58,8 +58,6 @@ QT_BEGIN_NAMESPACE -EGLDisplay QQnxGLContext::ms_eglDisplay = EGL_NO_DISPLAY; - static QEGLPlatformContext::Flags makeFlags() { QEGLPlatformContext::Flags result = 0; @@ -71,7 +69,8 @@ static QEGLPlatformContext::Flags makeFlags() } QQnxGLContext::QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QEGLPlatformContext(format, share, ms_eglDisplay, 0, QVariant(), makeFlags()) + : QEGLPlatformContext(format, share, QQnxIntegration::instance()->eglDisplay(), 0, QVariant(), + makeFlags()) { } @@ -79,28 +78,6 @@ QQnxGLContext::~QQnxGLContext() { } -void QQnxGLContext::initializeContext() -{ - qGLContextDebug(); - - // Initialize connection to EGL - ms_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (Q_UNLIKELY(ms_eglDisplay == EGL_NO_DISPLAY)) - qFatal("QQnxGLContext: failed to obtain EGL display: %x", eglGetError()); - - EGLBoolean eglResult = eglInitialize(ms_eglDisplay, 0, 0); - if (Q_UNLIKELY(eglResult != EGL_TRUE)) - qFatal("QQnxGLContext: failed to initialize EGL display, err=%d", eglGetError()); -} - -void QQnxGLContext::shutdownContext() -{ - qGLContextDebug(); - - // Close connection to EGL - eglTerminate(ms_eglDisplay); -} - EGLSurface QQnxGLContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) { QQnxEglWindow *window = static_cast(surface); diff --git a/src/plugins/platforms/qnx/qqnxglcontext.h b/src/plugins/platforms/qnx/qqnxglcontext.h index 19179a80e2..5d807ee9e4 100644 --- a/src/plugins/platforms/qnx/qqnxglcontext.h +++ b/src/plugins/platforms/qnx/qqnxglcontext.h @@ -58,19 +58,12 @@ public: QQnxGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share); virtual ~QQnxGLContext(); - static void initializeContext(); - static void shutdownContext(); - bool makeCurrent(QPlatformSurface *surface) override; void swapBuffers(QPlatformSurface *surface) override; void doneCurrent() override; protected: EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; - -private: - //Can be static because different displays returne the same handle - static EGLDisplay ms_eglDisplay; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index f479e94988..84baa6ec44 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -170,6 +170,9 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) #if QT_CONFIG(draganddrop) , m_drag(new QSimpleDrag()) #endif +#if QT_CONFIG(opengl) + , m_eglDisplay(EGL_NO_DISPLAY) +#endif { ms_instance = this; m_options = parseOptions(paramList); @@ -195,9 +198,8 @@ QQnxIntegration::QQnxIntegration(const QStringList ¶mList) QMetaObject::invokeMethod(m_navigatorEventNotifier, "start", Qt::QueuedConnection); #endif -#if !defined(QT_NO_OPENGL) - // Initialize global OpenGL resources - QQnxGLContext::initializeContext(); +#if QT_CONFIG(opengl) + createEglDisplay(); #endif // Create/start event thread @@ -284,9 +286,8 @@ QQnxIntegration::~QQnxIntegration() // Close connection to QNX composition manager screen_destroy_context(m_screenContext); -#if !defined(QT_NO_OPENGL) - // Cleanup global OpenGL resources - QQnxGLContext::shutdownContext(); +#if QT_CONFIG(opengl) + destroyEglDisplay(); #endif #if QT_CONFIG(qqnx_pps) @@ -741,4 +742,28 @@ bool QQnxIntegration::supportsNavigatorEvents() const return m_navigator != 0; } +#if QT_CONFIG(opengl) +void QQnxIntegration::createEglDisplay() +{ + qIntegrationDebug(); + + // Initialize connection to EGL + m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (Q_UNLIKELY(m_eglDisplay == EGL_NO_DISPLAY)) + qFatal("QQnxiIntegration: failed to obtain EGL display: %x", eglGetError()); + + EGLBoolean eglResult = eglInitialize(m_eglDisplay, 0, 0); + if (Q_UNLIKELY(eglResult != EGL_TRUE)) + qFatal("QQnxIntegration: failed to initialize EGL display, err=%d", eglGetError()); +} + +void QQnxIntegration::destroyEglDisplay() +{ + qIntegrationDebug(); + + // Close connection to EGL + eglTerminate(m_eglDisplay); +} +#endif + QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxintegration.h b/src/plugins/platforms/qnx/qqnxintegration.h index 0bf37880d1..2596af3c45 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.h +++ b/src/plugins/platforms/qnx/qqnxintegration.h @@ -46,6 +46,10 @@ #include +#if QT_CONFIG(opengl) +#include +#endif + QT_BEGIN_NAMESPACE class QQnxScreenEventThread; @@ -96,7 +100,8 @@ public: QPlatformWindow *createPlatformWindow(QWindow *window) const override; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; -#if !defined(QT_NO_OPENGL) +#if QT_CONFIG(opengl) + EGLDisplay eglDisplay() const { return m_eglDisplay; } QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; #endif @@ -175,6 +180,12 @@ private: Options m_options; +#if QT_CONFIG(opengl) + EGLDisplay m_eglDisplay; + void createEglDisplay(); + void destroyEglDisplay(); +#endif + static QQnxIntegration *ms_instance; friend class QQnxWindow; -- cgit v1.2.3 From 4522b17159a29ffd12c4d93be8a6e8e1a05dccd0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 6 Dec 2019 21:56:41 +0100 Subject: QStandardItemModel: do not reset persisten index in setItem() When an existing item is replaced with a new one in QStandardItemModel::setItem() then the persitent index is invalidated which leads to some unexpected behaviors (like e.g the header size and resize mode are reset). Therefore we have to make sure that the invalidation does not happen. This can be achieved by delaying the call to QStandardItem::setModel() for the old item until the new is properly added. After this, the old item no longer gets a valid QModelIndex from the model and therefore can't invalidate the persistent index anymore. Fixes: QTBUG-13605 Fixes: QTBUG-73000 Fixes: QTBUG-80586 Change-Id: I4e45e6feb81b7287c0859f638d7ab1a576fc2f0f Reviewed-by: David Faure --- src/gui/itemmodels/qstandarditemmodel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 2998808b54..9bdc22b49e 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -138,10 +138,19 @@ void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item, return; } } + + // setting the model to nullptr invalidates the persistent index which we want to avoid + if (!item && oldItem) + oldItem->d_func()->setModel(nullptr); + + children.replace(index, item); + + // since now indexFromItem() does no longer return a valid index, the persistent index + // will not be invalidated anymore if (oldItem) oldItem->d_func()->setModel(nullptr); delete oldItem; - children.replace(index, item); + if (item) item->d_func()->lastKnownIndex = index; -- cgit v1.2.3 From 4689e198e76e054ef51254c0724064ba61408625 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 13 Dec 2019 15:13:39 +0100 Subject: Doc/SQL: update sql driver creation instructions Fix the links, remove section about Q_ODBC_VERSION_2 - it wasn't there since Qt5.0. Change-Id: I571f5c2cf0f0e2df38638299c26814b510d1a8af Reviewed-by: Paul Wicking --- src/sql/doc/src/sql-driver.qdoc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 9c26c4089c..3a0fcfa1e7 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -171,7 +171,8 @@ \section3 How to Build the QMYSQL Plugin on Windows You need to get the MySQL installation files (e.g. - \e{mysql-installer-web-community-8.0.18.0.msi}). Run the installer, + \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.18.0.msi}). + Run the installer, select custom installation and install the MySQL C Connector which matches your Qt installation (x86 or x64). After installation make sure that the needed files are there: @@ -192,9 +193,9 @@ When you distribute your application, remember to include libmysql.dll in your installation package. It must be placed in the same folder - as the application executable. libmysql.dll additionally needs the + as the application executable. \e libmysql.dll additionally needs the MSVC runtime libraries which can be installed with vcredist.exe - (\l {https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads}(vcredist.exe) + (\l {https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads}{vcredist.exe} \target QOCI \section2 QOCI for the Oracle Call Interface (OCI) @@ -356,10 +357,6 @@ Windows NT based systems, this is the default. Note that the ODBC driver and the DBMS must also support Unicode. - Some driver managers and drivers do not support UNICODE. To use the - QODBC plugin with such drivers, it has to be compiled with - Q_ODBC_VERSION_2 defined. - For the Oracle 9 ODBC driver (Windows), it is necessary to check "SQL_WCHAR support" in the ODBC driver manager otherwise Oracle will convert all Unicode strings to local 8-bit. -- cgit v1.2.3 From 0edd2e39ad7f959c3d0c56e79abd3c60d9950538 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 11 Dec 2019 19:48:53 +0100 Subject: Let QItemSelectionModel::columnIntersectsSelection honor the parent QItemSelectionModel::columnIntersectsSelection() should honor the parent according to the docs. For rowIntersectsSelection() this was fixed a long time ago but columnIntersectsSelection() was forgotten. Sync the both functions and use range-based for loops as a drive-by. Fixes: QTBUG-80644 Change-Id: Iaf08f85e2225204d1e6564fa4bb0bc826352ed53 Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/corelib/itemmodels/qitemselectionmodel.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index c93a4d15b9..ebcc3b10ca 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -1627,10 +1627,9 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par QItemSelection sel = d->ranges; sel.merge(d->currentSelection, d->currentCommand); - for (int i = 0; i < sel.count(); ++i) { - QItemSelectionRange range = sel.at(i); + for (const QItemSelectionRange &range : qAsConst(sel)) { if (range.parent() != parent) - return false; + return false; int top = range.top(); int bottom = range.bottom(); int left = range.left(); @@ -1661,11 +1660,13 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde QItemSelection sel = d->ranges; sel.merge(d->currentSelection, d->currentCommand); - for (int i = 0; i < sel.count(); ++i) { - int left = sel.at(i).left(); - int right = sel.at(i).right(); - int top = sel.at(i).top(); - int bottom = sel.at(i).bottom(); + for (const QItemSelectionRange &range : qAsConst(sel)) { + if (range.parent() != parent) + return false; + int top = range.top(); + int bottom = range.bottom(); + int left = range.left(); + int right = range.right(); if (left <= column && right >= column) { for (int j = top; j <= bottom; j++) { const Qt::ItemFlags flags = d->model->index(j, column, parent).flags(); -- cgit v1.2.3 From 5b4b437b30b320e2cd7c9a566999a39772e5d431 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 10 Jun 2019 15:57:52 +0200 Subject: WebGradients: redo implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous implementation was *extremely* expensive. It relied on loading a binary JSON file from resources (which involved decompressing it), then extracting information out of it to build a gradient. Already-loaded gradients were kept in a local cache, which had to be mutex protected. Instead, this patch extends the gradient generator to build static arrays filled with the web gradient data, sitting in .rodata. These arrays are used when building QGradient objects with a web gradient. No explicit mutex protection is necessary, since accesses will just read from the arrays. As benefits, this patch removes: * the binary json representation from QtGui's resources (~4KB compressed, ~50KB uncompressed) * the overhead of reading from the JSON for each used web gradient; * the startup costs of registering the webgradients in the resources; * all the overhead of mutex locking when building such gradients; * all the runtime memory allocations to load, parse and cache the web gradients (including the memory + CPU spike on first load due to the uncompression of the JSON data, as well as a couple of deep copies). Change-Id: If5c3d704430df76ce8faf55ee75ebd4639ba09c4 Reviewed-by: Tor Arne Vestbø Reviewed-by: Ulf Hermann Reviewed-by: Qt CI Bot Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/gui/painting/WEBGRADIENTS_LICENSE.txt | 21 - src/gui/painting/painting.pri | 5 - src/gui/painting/qbrush.cpp | 55 +- src/gui/painting/qbrush.h | 24 +- src/gui/painting/qt_attribution.json | 14 - src/gui/painting/webgradients.binaryjson | Bin 50792 -> 0 bytes src/gui/painting/webgradients.cpp | 578 +++++++++++++++++++ src/gui/painting/webgradients.css | 909 ------------------------------ 8 files changed, 600 insertions(+), 1006 deletions(-) delete mode 100644 src/gui/painting/WEBGRADIENTS_LICENSE.txt delete mode 100644 src/gui/painting/webgradients.binaryjson create mode 100644 src/gui/painting/webgradients.cpp delete mode 100644 src/gui/painting/webgradients.css (limited to 'src') diff --git a/src/gui/painting/WEBGRADIENTS_LICENSE.txt b/src/gui/painting/WEBGRADIENTS_LICENSE.txt deleted file mode 100644 index 1a4d527a4d..0000000000 --- a/src/gui/painting/WEBGRADIENTS_LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 itmeo - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index fcf6488edd..1a0f4f11e4 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -111,13 +111,8 @@ SOURCES += \ painting/qplatformbackingstore.cpp \ painting/qpathsimplifier.cpp -webgradients.files = painting/webgradients.binaryjson -webgradients.prefix = qgradient -webgradients.base = painting - RESOURCES += \ painting/qpdf.qrc \ - webgradients darwin { HEADERS += painting/qcoregraphics_p.h diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index b23fb45952..83032bdc4f 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -1347,6 +1348,8 @@ QGradient::QGradient() based on the gradients from https://webgradients.com/. */ +#include "webgradients.cpp" + /*! \fn QGradient::QGradient(QGradient::Preset preset) \since 5.12 @@ -1358,47 +1361,12 @@ QGradient::QGradient() to be applied to arbitrary object sizes. */ QGradient::QGradient(Preset preset) - : QGradient() -{ - static QHash cachedPresets; - static QMutex cacheMutex; - QMutexLocker locker(&cacheMutex); - if (cachedPresets.contains(preset)) { - const QGradient &cachedPreset = cachedPresets.value(preset); - m_type = cachedPreset.m_type; - m_data = cachedPreset.m_data; - m_stops = cachedPreset.m_stops; - m_spread = cachedPreset.m_spread; - dummy = cachedPreset.dummy; - } else { - static QJsonDocument jsonPresets = []() { - QFile webGradients(QLatin1String(":/qgradient/webgradients.binaryjson")); - webGradients.open(QFile::ReadOnly); - return QJsonDocument::fromBinaryData(webGradients.readAll()); - }(); - - const QJsonValue presetData = jsonPresets[preset - 1]; - if (!presetData.isObject()) - return; - - m_type = LinearGradient; - setCoordinateMode(ObjectMode); - setSpread(PadSpread); - - const QJsonValue start = presetData[QLatin1String("start")]; - const QJsonValue end = presetData[QLatin1String("end")]; - m_data.linear.x1 = start[QLatin1String("x")].toDouble(); - m_data.linear.y1 = start[QLatin1String("y")].toDouble(); - m_data.linear.x2 = end[QLatin1String("x")].toDouble(); - m_data.linear.y2 = end[QLatin1String("y")].toDouble(); - - for (const QJsonValue &stop : presetData[QLatin1String("stops")].toArray()) { - setColorAt(stop[QLatin1String("position")].toDouble(), - QColor(QRgb(stop[QLatin1String("color")].toInt()))); - } - - cachedPresets.insert(preset, *this); - } + : m_type(LinearGradient) + , m_spread(PadSpread) + , m_stops(qt_preset_gradient_stops(preset)) + , m_data(qt_preset_gradient_data[preset - 1]) + , dummy(qt_preset_gradient_dummy()) +{ } /*! @@ -1408,11 +1376,6 @@ QGradient::~QGradient() { } -QT_END_NAMESPACE -static void initGradientPresets() { Q_INIT_RESOURCE(qmake_webgradients); } -Q_CONSTRUCTOR_FUNCTION(initGradientPresets); -QT_BEGIN_NAMESPACE - /*! \enum QGradient::Type diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 6a4ffab1c5..1d7199782f 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -400,16 +400,7 @@ public: inline bool operator!=(const QGradient &other) const { return !operator==(other); } -private: - friend class QLinearGradient; - friend class QRadialGradient; - friend class QConicalGradient; - friend class QBrush; - - Type m_type; - Spread m_spread; - QGradientStops m_stops; - union { + union QGradientData { struct { qreal x1, y1, x2, y2; } linear; @@ -419,7 +410,18 @@ private: struct { qreal cx, cy, angle; } conical; - } m_data; + }; + +private: + friend class QLinearGradient; + friend class QRadialGradient; + friend class QConicalGradient; + friend class QBrush; + + Type m_type; + Spread m_spread; + QGradientStops m_stops; + QGradientData m_data; void *dummy; // ### Qt 6: replace with actual content (CoordinateMode, InterpolationMode, ...) }; diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json index 7b16e8c211..e2326a56c1 100644 --- a/src/gui/painting/qt_attribution.json +++ b/src/gui/painting/qt_attribution.json @@ -28,20 +28,6 @@ (C) Carsten Haitzler and various contributors. (C) Willem Monsuwe " }, - { - "Id": "webgradients", - "Name": "WebGradients", - "QDocModule": "qtgui", - "QtUsage": "Used in Qt GUI to provide presets for QGradient.", - "Files": "webgradients.css", - - "Description": "WebGradients is a free collection of 180 linear gradients.", - "Homepage": "https://webgradients.com/", - "License": "MIT License", - "LicenseId": "MIT", - "LicenseFile": "WEBGRADIENTS_LICENSE.txt", - "Copyright": "Copyright (c) 2017 itmeo" - }, { "Id": "xserverhelper", "Name": "X Server helper", diff --git a/src/gui/painting/webgradients.binaryjson b/src/gui/painting/webgradients.binaryjson deleted file mode 100644 index 75edd487be..0000000000 Binary files a/src/gui/painting/webgradients.binaryjson and /dev/null differ diff --git a/src/gui/painting/webgradients.cpp b/src/gui/painting/webgradients.cpp new file mode 100644 index 0000000000..b4d297450b --- /dev/null +++ b/src/gui/painting/webgradients.cpp @@ -0,0 +1,578 @@ +/**************************************************************************** +** +** Copyright (C) 2019 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// This file is auto-generated by gradientgen. DO NOT EDIT! + +static QArrayDataPointerRef qt_preset_gradient_stops(QGradient::Preset preset) +{ + Q_ASSERT(preset < QGradient::NumPresets); + switch (preset) { + case QGradient::WarmFlame: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(250, 208, 196, 255))); + case QGradient::NightFade: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 140, 209, 255)), QGradientStop(1, QColor(251, 194, 235, 255))); + case QGradient::SpringWarmth: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 208, 196, 255)), QGradientStop(0.01, QColor(250, 208, 196, 255)), QGradientStop(1, QColor(255, 209, 255, 255))); + case QGradient::JuicyPeach: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 236, 210, 255)), QGradientStop(1, QColor(252, 182, 159, 255))); + case QGradient::YoungPassion: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 129, 119, 255)), QGradientStop(0, QColor(255, 134, 122, 255)), QGradientStop(0.21, QColor(255, 140, 127, 255)), QGradientStop(0.52, QColor(249, 145, 133, 255)), QGradientStop(0.78, QColor(207, 85, 108, 255)), QGradientStop(1, QColor(177, 42, 91, 255))); + case QGradient::LadyLips: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 154, 158, 255)), QGradientStop(0.99, QColor(254, 207, 239, 255)), QGradientStop(1, QColor(254, 207, 239, 255))); + case QGradient::SunnyMorning: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(246, 211, 101, 255)), QGradientStop(1, QColor(253, 160, 133, 255))); + case QGradient::RainyAshville: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(251, 194, 235, 255)), QGradientStop(1, QColor(166, 193, 238, 255))); + case QGradient::FrozenDreams: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 203, 241, 255)), QGradientStop(0.01, QColor(253, 203, 241, 255)), QGradientStop(1, QColor(230, 222, 233, 255))); + case QGradient::WinterNeva: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(161, 196, 253, 255)), QGradientStop(1, QColor(194, 233, 251, 255))); + case QGradient::DustyGrass: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 252, 121, 255)), QGradientStop(1, QColor(150, 230, 161, 255))); + case QGradient::TemptingAzure: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(132, 250, 176, 255)), QGradientStop(1, QColor(143, 211, 244, 255))); + case QGradient::HeavyRain: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(207, 217, 223, 255)), QGradientStop(1, QColor(226, 235, 240, 255))); + case QGradient::AmyCrisp: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(166, 192, 254, 255)), QGradientStop(1, QColor(246, 128, 132, 255))); + case QGradient::MeanFruit: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 203, 144, 255)), QGradientStop(1, QColor(213, 126, 235, 255))); + case QGradient::DeepBlue: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(224, 195, 252, 255)), QGradientStop(1, QColor(142, 197, 252, 255))); + case QGradient::RipeMalinka: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(240, 147, 251, 255)), QGradientStop(1, QColor(245, 87, 108, 255))); + case QGradient::CloudyKnoxville: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 251, 251, 255)), QGradientStop(1, QColor(235, 237, 238, 255))); + case QGradient::MalibuBeach: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 172, 254, 255)), QGradientStop(1, QColor(0, 242, 254, 255))); + case QGradient::NewLife: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 233, 123, 255)), QGradientStop(1, QColor(56, 249, 215, 255))); + case QGradient::TrueSunset: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(250, 112, 154, 255)), QGradientStop(1, QColor(254, 225, 64, 255))); + case QGradient::MorpheusDen: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(48, 207, 208, 255)), QGradientStop(1, QColor(51, 8, 103, 255))); + case QGradient::RareWind: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 237, 234, 255)), QGradientStop(1, QColor(254, 214, 227, 255))); + case QGradient::NearMoon: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(94, 231, 223, 255)), QGradientStop(1, QColor(180, 144, 202, 255))); + case QGradient::WildApple: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(210, 153, 194, 255)), QGradientStop(1, QColor(254, 249, 215, 255))); + case QGradient::SaintPetersburg: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(245, 247, 250, 255)), QGradientStop(1, QColor(195, 207, 226, 255))); + case QGradient::PlumPlate: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(102, 126, 234, 255)), QGradientStop(1, QColor(118, 75, 162, 255))); + case QGradient::EverlastingSky: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 252, 251, 255)), QGradientStop(1, QColor(226, 209, 195, 255))); + case QGradient::HappyFisher: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(137, 247, 254, 255)), QGradientStop(1, QColor(102, 166, 255, 255))); + case QGradient::Blessing: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(253, 219, 146, 255)), QGradientStop(1, QColor(209, 253, 255, 255))); + case QGradient::SharpeyeEagle: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(152, 144, 227, 255)), QGradientStop(1, QColor(177, 244, 207, 255))); + case QGradient::LadogaBottom: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 192, 253, 255)), QGradientStop(1, QColor(217, 222, 216, 255))); + case QGradient::LemonGate: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 251, 196, 255)), QGradientStop(1, QColor(249, 245, 134, 255))); + case QGradient::ItmeoBranding: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(42, 245, 152, 255)), QGradientStop(1, QColor(0, 158, 253, 255))); + case QGradient::ZeusMiracle: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(205, 156, 242, 255)), QGradientStop(1, QColor(246, 243, 255, 255))); + case QGradient::OldHat: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(228, 175, 203, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0.3, QColor(226, 197, 139, 255)), QGradientStop(0.64, QColor(194, 206, 156, 255)), QGradientStop(1, QColor(126, 219, 220, 255))); + case QGradient::StarWine: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(184, 203, 184, 255)), QGradientStop(0, QColor(180, 101, 218, 255)), QGradientStop(0.33, QColor(207, 108, 201, 255)), QGradientStop(0.66, QColor(238, 96, 156, 255)), QGradientStop(1, QColor(238, 96, 156, 255))); + case QGradient::HappyAcid: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(55, 236, 186, 255)), QGradientStop(1, QColor(114, 175, 211, 255))); + case QGradient::AwesomePine: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(235, 187, 167, 255)), QGradientStop(1, QColor(207, 199, 248, 255))); + case QGradient::NewYork: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 241, 235, 255)), QGradientStop(1, QColor(172, 224, 249, 255))); + case QGradient::ShyRainbow: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 162, 162, 255)), QGradientStop(0.19, QColor(187, 193, 191, 255)), QGradientStop(0.42, QColor(87, 198, 225, 255)), QGradientStop(0.79, QColor(180, 159, 218, 255)), QGradientStop(1, QColor(122, 197, 216, 255))); + case QGradient::MixedHopes: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 113, 245, 255)), QGradientStop(1, QColor(250, 113, 205, 255))); + case QGradient::FlyHigh: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(72, 198, 239, 255)), QGradientStop(1, QColor(111, 134, 214, 255))); + case QGradient::StrongBliss: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 140, 160, 255)), QGradientStop(0.19, QColor(249, 116, 143, 255)), QGradientStop(0.6, QColor(253, 134, 140, 255)), QGradientStop(1, QColor(254, 154, 139, 255))); + case QGradient::FreshMilk: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(254, 173, 166, 255)), QGradientStop(1, QColor(245, 239, 239, 255))); + case QGradient::SnowAgain: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 233, 240, 255)), QGradientStop(1, QColor(238, 241, 245, 255))); + case QGradient::FebruaryInk: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 203, 238, 255)), QGradientStop(1, QColor(231, 240, 253, 255))); + case QGradient::KindSteel: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(233, 222, 250, 255)), QGradientStop(1, QColor(251, 252, 219, 255))); + case QGradient::SoftGrass: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 223, 196, 255)), QGradientStop(1, QColor(222, 236, 221, 255))); + case QGradient::GrownEarly: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(11, 163, 96, 255)), QGradientStop(1, QColor(60, 186, 146, 255))); + case QGradient::SharpBlues: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 198, 251, 255)), QGradientStop(1, QColor(0, 91, 234, 255))); + case QGradient::ShadyWater: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(116, 235, 213, 255)), QGradientStop(1, QColor(159, 172, 230, 255))); + case QGradient::DirtyBeauty: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(106, 133, 182, 255)), QGradientStop(1, QColor(186, 200, 224, 255))); + case QGradient::GreatWhale: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(163, 189, 237, 255)), QGradientStop(1, QColor(105, 145, 199, 255))); + case QGradient::TeenNotebook: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(151, 149, 240, 255)), QGradientStop(1, QColor(251, 200, 212, 255))); + case QGradient::PoliteRumors: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(167, 166, 203, 255)), QGradientStop(0.52, QColor(137, 137, 186, 255)), QGradientStop(1, QColor(137, 137, 186, 255))); + case QGradient::SweetPeriod: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(63, 81, 177, 255)), QGradientStop(0.13, QColor(90, 85, 174, 255)), QGradientStop(0.25, QColor(123, 95, 172, 255)), QGradientStop(0.38, QColor(143, 106, 174, 255)), QGradientStop(0.5, QColor(168, 106, 164, 255)), QGradientStop(0.62, QColor(204, 107, 142, 255)), QGradientStop(0.75, QColor(241, 130, 113, 255)), QGradientStop(0.87, QColor(243, 164, 105, 255)), QGradientStop(1, QColor(247, 201, 120, 255))); + case QGradient::WideMatrix: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 197, 228, 255)), QGradientStop(0.15, QColor(253, 163, 75, 255)), QGradientStop(0.35, QColor(255, 120, 130, 255)), QGradientStop(0.52, QColor(200, 105, 158, 255)), QGradientStop(0.71, QColor(112, 70, 170, 255)), QGradientStop(0.87, QColor(12, 29, 184, 255)), QGradientStop(1, QColor(2, 15, 117, 255))); + case QGradient::SoftCherish: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(219, 220, 215, 255)), QGradientStop(0.24, QColor(221, 220, 215, 255)), QGradientStop(0.3, QColor(226, 201, 204, 255)), QGradientStop(0.46, QColor(231, 98, 125, 255)), QGradientStop(0.59, QColor(184, 35, 90, 255)), QGradientStop(0.71, QColor(128, 19, 87, 255)), QGradientStop(0.84, QColor(61, 22, 53, 255)), QGradientStop(1, QColor(28, 26, 39, 255))); + case QGradient::RedSalvation: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(244, 59, 71, 255)), QGradientStop(1, QColor(69, 58, 148, 255))); + case QGradient::BurningSpring: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(79, 181, 118, 255)), QGradientStop(0.3, QColor(68, 196, 137, 255)), QGradientStop(0.46, QColor(40, 169, 174, 255)), QGradientStop(0.59, QColor(40, 162, 183, 255)), QGradientStop(0.71, QColor(76, 119, 136, 255)), QGradientStop(0.86, QColor(108, 79, 99, 255)), QGradientStop(1, QColor(67, 44, 57, 255))); + case QGradient::NightParty: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(2, 80, 197, 255)), QGradientStop(1, QColor(212, 63, 141, 255))); + case QGradient::SkyGlider: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(136, 211, 206, 255)), QGradientStop(1, QColor(110, 69, 226, 255))); + case QGradient::HeavenPeach: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(217, 175, 217, 255)), QGradientStop(1, QColor(151, 217, 225, 255))); + case QGradient::PurpleDivision: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 40, 228, 255)), QGradientStop(1, QColor(229, 178, 202, 255))); + case QGradient::AquaSplash: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(19, 84, 122, 255)), QGradientStop(1, QColor(128, 208, 199, 255))); + case QGradient::SpikyNaga: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 82, 133, 255)), QGradientStop(0.12, QColor(88, 94, 146, 255)), QGradientStop(0.25, QColor(101, 104, 159, 255)), QGradientStop(0.37, QColor(116, 116, 176, 255)), QGradientStop(0.5, QColor(126, 126, 187, 255)), QGradientStop(0.62, QColor(131, 137, 199, 255)), QGradientStop(0.75, QColor(151, 149, 212, 255)), QGradientStop(0.87, QColor(162, 161, 220, 255)), QGradientStop(1, QColor(181, 174, 228, 255))); + case QGradient::LoveKiss: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 8, 68, 255)), QGradientStop(1, QColor(255, 177, 153, 255))); + case QGradient::CleanMirror: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255))); + case QGradient::PremiumDark: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(67, 67, 67, 255)), QGradientStop(1, QColor(0, 0, 0, 255))); + case QGradient::ColdEvening: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(12, 52, 131, 255)), QGradientStop(1, QColor(162, 182, 223, 255)), QGradientStop(1, QColor(107, 140, 206, 255)), QGradientStop(1, QColor(162, 182, 223, 255))); + case QGradient::CochitiLake: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(147, 165, 207, 255)), QGradientStop(1, QColor(228, 239, 233, 255))); + case QGradient::SummerGames: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(146, 254, 157, 255)), QGradientStop(1, QColor(0, 201, 255, 255))); + case QGradient::PassionateBed: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 117, 140, 255)), QGradientStop(1, QColor(255, 126, 179, 255))); + case QGradient::MountainRock: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(134, 143, 150, 255)), QGradientStop(1, QColor(89, 97, 100, 255))); + case QGradient::DesertHump: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 144, 129, 255)), QGradientStop(1, QColor(223, 165, 121, 255))); + case QGradient::JungleDay: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(139, 170, 170, 255)), QGradientStop(1, QColor(174, 139, 156, 255))); + case QGradient::PhoenixStart: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(248, 54, 0, 255)), QGradientStop(1, QColor(249, 212, 35, 255))); + case QGradient::OctoberSilence: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 33, 255, 255)), QGradientStop(1, QColor(33, 212, 253, 255))); + case QGradient::FarawayRiver: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(110, 69, 226, 255)), QGradientStop(1, QColor(136, 211, 206, 255))); + case QGradient::AlchemistLab: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 88, 200, 255)), QGradientStop(1, QColor(36, 210, 146, 255))); + case QGradient::OverSun: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(171, 236, 214, 255)), QGradientStop(1, QColor(251, 237, 150, 255))); + case QGradient::PremiumWhite: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 212, 208, 255)), QGradientStop(0.01, QColor(213, 212, 208, 255)), QGradientStop(0.31, QColor(238, 238, 236, 255)), QGradientStop(0.75, QColor(239, 238, 236, 255)), QGradientStop(1, QColor(233, 233, 231, 255))); + case QGradient::MarsParty: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(95, 114, 189, 255)), QGradientStop(1, QColor(155, 35, 234, 255))); + case QGradient::EternalConstance: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(9, 32, 63, 255)), QGradientStop(1, QColor(83, 120, 149, 255))); + case QGradient::JapanBlush: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(221, 214, 243, 255)), QGradientStop(1, QColor(250, 172, 168, 255)), QGradientStop(1, QColor(250, 172, 168, 255))); + case QGradient::SmilingRain: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(220, 176, 237, 255)), QGradientStop(1, QColor(153, 201, 156, 255))); + case QGradient::CloudyApple: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(243, 231, 233, 255)), QGradientStop(0.99, QColor(227, 238, 255, 255)), QGradientStop(1, QColor(227, 238, 255, 255))); + case QGradient::BigMango: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(199, 29, 111, 255)), QGradientStop(1, QColor(208, 150, 147, 255))); + case QGradient::HealthyWater: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(150, 222, 218, 255)), QGradientStop(1, QColor(80, 201, 195, 255))); + case QGradient::AmourAmour: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 112, 98, 255)), QGradientStop(1, QColor(254, 81, 150, 255))); + case QGradient::RiskyConcrete: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(196, 197, 199, 255)), QGradientStop(0.52, QColor(220, 221, 223, 255)), QGradientStop(1, QColor(235, 235, 235, 255))); + case QGradient::StrongStick: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 202, 186, 255)), QGradientStop(1, QColor(93, 65, 87, 255))); + case QGradient::ViciousStance: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(41, 50, 60, 255)), QGradientStop(1, QColor(72, 85, 99, 255))); + case QGradient::PaloAlto: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(22, 160, 133, 255)), QGradientStop(1, QColor(244, 208, 63, 255))); + case QGradient::HappyMemories: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 88, 88, 255)), QGradientStop(1, QColor(240, 152, 25, 255))); + case QGradient::MidnightBloom: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(43, 88, 118, 255)), QGradientStop(1, QColor(78, 67, 118, 255))); + case QGradient::Crystalline: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 205, 172, 255)), QGradientStop(1, QColor(141, 218, 213, 255))); + case QGradient::PartyBliss: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255))); + case QGradient::ConfidentCloud: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(218, 212, 236, 255)), QGradientStop(0.01, QColor(218, 212, 236, 255)), QGradientStop(1, QColor(243, 231, 233, 255))); + case QGradient::LeCocktail: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(135, 77, 162, 255)), QGradientStop(1, QColor(196, 58, 48, 255))); + case QGradient::RiverCity: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(68, 129, 235, 255)), QGradientStop(1, QColor(4, 190, 254, 255))); + case QGradient::FrozenBerry: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(232, 25, 139, 255)), QGradientStop(1, QColor(199, 234, 253, 255))); + case QGradient::ChildCare: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(247, 148, 164, 255)), QGradientStop(1, QColor(253, 214, 189, 255))); + case QGradient::FlyingLemon: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(100, 179, 244, 255)), QGradientStop(1, QColor(194, 229, 156, 255))); + case QGradient::NewRetrowave: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(59, 65, 197, 255)), QGradientStop(0.49, QColor(169, 129, 187, 255)), QGradientStop(1, QColor(255, 200, 169, 255))); + case QGradient::HiddenJaguar: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(15, 216, 80, 255)), QGradientStop(1, QColor(249, 240, 71, 255))); + case QGradient::AboveTheSky: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(211, 211, 211, 255)), QGradientStop(0.01, QColor(211, 211, 211, 255)), QGradientStop(0.26, QColor(224, 224, 224, 255)), QGradientStop(0.48, QColor(239, 239, 239, 255)), QGradientStop(0.75, QColor(217, 217, 217, 255)), QGradientStop(1, QColor(188, 188, 188, 255))); + case QGradient::Nega: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(238, 156, 167, 255)), QGradientStop(1, QColor(255, 221, 225, 255))); + case QGradient::DenseWater: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(58, 181, 176, 255)), QGradientStop(0.31, QColor(61, 153, 190, 255)), QGradientStop(1, QColor(86, 49, 122, 255))); + case QGradient::Seashore: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 156, 255, 255)), QGradientStop(1, QColor(104, 224, 207, 255))); + case QGradient::MarbleWall: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(189, 194, 232, 255)), QGradientStop(0.01, QColor(189, 194, 232, 255)), QGradientStop(1, QColor(230, 222, 233, 255))); + case QGradient::CheerfulCaramel: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(230, 185, 128, 255)), QGradientStop(1, QColor(234, 205, 163, 255))); + case QGradient::NightSky: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(30, 60, 114, 255)), QGradientStop(0.01, QColor(30, 60, 114, 255)), QGradientStop(1, QColor(42, 82, 152, 255))); + case QGradient::MagicLake: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(213, 222, 231, 255)), QGradientStop(0, QColor(255, 175, 189, 255)), QGradientStop(1, QColor(201, 255, 191, 255))); + case QGradient::YoungGrass: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(155, 225, 93, 255)), QGradientStop(1, QColor(0, 227, 174, 255))); + case QGradient::ColorfulPeach: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255))); + case QGradient::GentleCare: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 195, 160, 255)), QGradientStop(1, QColor(255, 175, 189, 255))); + case QGradient::PlumBath: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(204, 32, 142, 255)), QGradientStop(1, QColor(103, 19, 210, 255))); + case QGradient::HappyUnicorn: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(179, 255, 171, 255)), QGradientStop(1, QColor(18, 255, 247, 255))); + case QGradient::AfricanField: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 189, 96, 255)), QGradientStop(0.25, QColor(90, 193, 168, 255)), QGradientStop(0.5, QColor(62, 198, 237, 255)), QGradientStop(0.75, QColor(183, 221, 183, 255)), QGradientStop(1, QColor(254, 243, 129, 255))); + case QGradient::SolidStone: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(36, 57, 73, 255)), QGradientStop(1, QColor(81, 127, 164, 255))); + case QGradient::OrangeJuice: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(252, 96, 118, 255)), QGradientStop(1, QColor(255, 154, 68, 255))); + case QGradient::GlassWater: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 233, 243, 255)), QGradientStop(1, QColor(255, 255, 255, 255))); + case QGradient::NorthMiracle: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 219, 222, 255)), QGradientStop(1, QColor(252, 0, 255, 255))); + case QGradient::FruitBlend: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(249, 212, 35, 255)), QGradientStop(1, QColor(255, 78, 80, 255))); + case QGradient::MillenniumPine: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(80, 204, 127, 255)), QGradientStop(1, QColor(245, 209, 0, 255))); + case QGradient::HighFlight: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(10, 207, 254, 255)), QGradientStop(1, QColor(73, 90, 255, 255))); + case QGradient::MoleHall: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(97, 97, 97, 255)), QGradientStop(1, QColor(155, 197, 195, 255))); + case QGradient::SpaceShift: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 51, 147, 255)), QGradientStop(0.37, QColor(43, 118, 185, 255)), QGradientStop(0.65, QColor(44, 172, 209, 255)), QGradientStop(1, QColor(53, 235, 147, 255))); + case QGradient::ForestInei: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 137, 181, 255)), QGradientStop(1, QColor(191, 217, 254, 255))); + case QGradient::RoyalGarden: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(237, 110, 160, 255)), QGradientStop(1, QColor(236, 140, 105, 255))); + case QGradient::RichMetal: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(215, 210, 204, 255)), QGradientStop(1, QColor(48, 67, 82, 255))); + case QGradient::JuicyCake: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(225, 79, 173, 255)), QGradientStop(1, QColor(249, 212, 35, 255))); + case QGradient::SmartIndigo: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(178, 36, 239, 255)), QGradientStop(1, QColor(117, 121, 255, 255))); + case QGradient::SandStrike: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(0, QColor(193, 193, 97, 255)), QGradientStop(1, QColor(212, 212, 177, 255))); + case QGradient::NorseBeauty: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(236, 119, 171, 255)), QGradientStop(1, QColor(120, 115, 245, 255))); + case QGradient::AquaGuidance: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(0, 122, 223, 255)), QGradientStop(1, QColor(0, 236, 188, 255))); + case QGradient::SunVeggie: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(32, 226, 215, 255)), QGradientStop(1, QColor(249, 254, 165, 255))); + case QGradient::SeaLord: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.56, QColor(197, 193, 255, 255)), QGradientStop(1, QColor(255, 186, 195, 255))); + case QGradient::BlackSea: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(44, 216, 213, 255)), QGradientStop(0.48, QColor(107, 141, 214, 255)), QGradientStop(1, QColor(142, 55, 215, 255))); + case QGradient::GrassShampoo: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(223, 255, 205, 255)), QGradientStop(0.48, QColor(144, 249, 196, 255)), QGradientStop(1, QColor(57, 243, 187, 255))); + case QGradient::LandingAircraft: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(93, 159, 255, 255)), QGradientStop(0.48, QColor(184, 220, 255, 255)), QGradientStop(1, QColor(107, 187, 255, 255))); + case QGradient::WitchDance: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(168, 191, 255, 255)), QGradientStop(1, QColor(136, 77, 128, 255))); + case QGradient::SleeplessNight: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(82, 113, 196, 255)), QGradientStop(0.48, QColor(177, 159, 255, 255)), QGradientStop(1, QColor(236, 161, 254, 255))); + case QGradient::AngelCare: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 226, 159, 255)), QGradientStop(0.48, QColor(255, 169, 159, 255)), QGradientStop(1, QColor(255, 113, 154, 255))); + case QGradient::CrystalRiver: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(34, 225, 255, 255)), QGradientStop(0.48, QColor(29, 143, 225, 255)), QGradientStop(1, QColor(98, 94, 177, 255))); + case QGradient::SoftLipstick: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(182, 206, 232, 255)), QGradientStop(1, QColor(245, 120, 220, 255))); + case QGradient::SaltMountain: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 254, 255, 255)), QGradientStop(1, QColor(215, 255, 254, 255))); + case QGradient::PerfectWhite: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(227, 253, 245, 255)), QGradientStop(1, QColor(255, 230, 250, 255))); + case QGradient::FreshOasis: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(125, 226, 252, 255)), QGradientStop(1, QColor(185, 182, 229, 255))); + case QGradient::StrictNovember: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(203, 186, 204, 255)), QGradientStop(1, QColor(37, 128, 179, 255))); + case QGradient::MorningSalad: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(183, 248, 219, 255)), QGradientStop(1, QColor(80, 167, 194, 255))); + case QGradient::DeepRelief: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(112, 133, 182, 255)), QGradientStop(0.5, QColor(135, 167, 217, 255)), QGradientStop(1, QColor(222, 243, 248, 255))); + case QGradient::SeaStrike: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 255, 210, 255)), QGradientStop(0.48, QColor(98, 151, 219, 255)), QGradientStop(1, QColor(30, 236, 255, 255))); + case QGradient::NightCall: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(172, 50, 228, 255)), QGradientStop(0.48, QColor(121, 24, 242, 255)), QGradientStop(1, QColor(72, 1, 255, 255))); + case QGradient::SupremeSky: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(212, 255, 236, 255)), QGradientStop(0.48, QColor(87, 242, 204, 255)), QGradientStop(1, QColor(69, 150, 251, 255))); + case QGradient::LightBlue: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(158, 251, 211, 255)), QGradientStop(0.48, QColor(87, 233, 242, 255)), QGradientStop(1, QColor(69, 212, 251, 255))); + case QGradient::MindCrawl: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(71, 59, 123, 255)), QGradientStop(0.51, QColor(53, 132, 167, 255)), QGradientStop(1, QColor(48, 210, 190, 255))); + case QGradient::LilyMeadow: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(101, 55, 155, 255)), QGradientStop(0.53, QColor(136, 106, 234, 255)), QGradientStop(1, QColor(100, 87, 198, 255))); + case QGradient::SugarLollipop: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(164, 69, 178, 255)), QGradientStop(0.52, QColor(212, 24, 114, 255)), QGradientStop(1, QColor(255, 0, 102, 255))); + case QGradient::SweetDessert: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(119, 66, 178, 255)), QGradientStop(0.52, QColor(241, 128, 255, 255)), QGradientStop(1, QColor(253, 139, 217, 255))); + case QGradient::MagicRay: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 60, 172, 255)), QGradientStop(0.52, QColor(86, 43, 124, 255)), QGradientStop(1, QColor(43, 134, 197, 255))); + case QGradient::TeenParty: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.5, QColor(141, 11, 147, 255)), QGradientStop(1, QColor(50, 21, 117, 255))); + case QGradient::FrozenHeat: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(255, 5, 124, 255)), QGradientStop(0.48, QColor(124, 100, 213, 255)), QGradientStop(1, QColor(76, 195, 255, 255))); + case QGradient::GagarinView: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(105, 234, 203, 255)), QGradientStop(0.48, QColor(234, 204, 248, 255)), QGradientStop(1, QColor(102, 84, 241, 255))); + case QGradient::FabledSunset: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(35, 21, 87, 255)), QGradientStop(0.29, QColor(68, 16, 122, 255)), QGradientStop(0.67, QColor(255, 19, 97, 255)), QGradientStop(1, QColor(255, 248, 0, 255))); + case QGradient::PerfectBlue: + return Q_ARRAY_LITERAL(QGradientStop, QGradientStop(0, QColor(61, 78, 129, 255)), QGradientStop(0.48, QColor(87, 83, 201, 255)), QGradientStop(1, QColor(110, 127, 243, 255))); + case QGradient::NumPresets: + Q_UNREACHABLE(); + } + Q_UNREACHABLE(); + return {}; +} + +static Q_CONSTEXPR QGradient::QGradientData qt_preset_gradient_data[] = { + { { 0, 1, 1, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { 0.5, 1, 0.5, 0 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 0, 0 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { -0.0915064, 0.158494, 1.09151, 0.841506 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 0, 0.5, 1 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0, 0, 0 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.341506, 1.09151, 0.658494, -0.0915064 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 0, 0 } }, + { { 0, 1, 1, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 1, 1, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 1, 1, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { -0.0915064, 0.841506, 1.09151, 0.158494 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { -0.0915064, 0.841506, 1.09151, 0.158494 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { -0.0915064, 0.841506, 1.09151, 0.158494 } }, + { { 1.09151, 0.841506, -0.0915064, 0.158494 } }, + { { 1.09151, 0.841506, -0.0915064, 0.158494 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 1, 1, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 0, 0 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { -0.0915064, 0.841506, 1.09151, 0.158494 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 1, 1, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 0, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 0, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.719186, 1.10221, 0.280814, -0.102208 } }, + { { 0, 0, 0, 0 } }, + { { -0.0915064, 0.841506, 1.09151, 0.158494 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0, 0.5, 1, 0.5 } }, + { { 0.5, 1, 0.5, 0 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, + { { 0, 0, 1, 1 } }, +}; + +static void *qt_preset_gradient_dummy() +{ + union {void *p; uint i;}; + p = 0; + i |= uint(QGradient::ObjectMode); + return p; +} diff --git a/src/gui/painting/webgradients.css b/src/gui/painting/webgradients.css deleted file mode 100644 index 870866bb46..0000000000 --- a/src/gui/painting/webgradients.css +++ /dev/null @@ -1,909 +0,0 @@ -/*001 Warm Flame*/ -.warm_flame{ - background-image: linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%); -} - -/*002 Night Fade*/ -.night_fade{ - background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%); -} - -/*003 Spring Warmth*/ -.spring_warmth{ - background-image: linear-gradient(to top, #fad0c4 0%, #fad0c4 1%, #ffd1ff 100%); -} - -/*004 Juicy Peach*/ -.juicy_peach{ - background-image: linear-gradient(to right, #ffecd2 0%, #fcb69f 100%); -} - -/*005 Young Passion*/ -.young_passion{ - background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%); -} - -/*006 Lady Lips*/ -.lady_lips{ - background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%); -} - -/*007 Sunny Morning*/ -.sunny_morning{ - background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%); -} - -/*008 Rainy Ashville*/ -.rainy_ashville{ - background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%); -} - -/*009 Frozen Dreams*/ -.frozen_dreams{ - background-image: linear-gradient(to top, #fdcbf1 0%, #fdcbf1 1%, #e6dee9 100%); -} - -/*010 Winter Neva*/ -.winter_neva{ - background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%); -} - -/*011 Dusty Grass*/ -.dusty_grass{ - background-image: linear-gradient(120deg, #d4fc79 0%, #96e6a1 100%); -} - -/*012 Tempting Azure*/ -.tempting_azure{ - background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%); -} - -/*013 Heavy Rain*/ -.heavy_rain{ - background-image: linear-gradient(to top, #cfd9df 0%, #e2ebf0 100%); -} - -/*014 Amy Crisp*/ -.amy_crisp{ - background-image: linear-gradient(120deg, #a6c0fe 0%, #f68084 100%); -} - -/*015 Mean Fruit*/ -.mean_fruit{ - background-image: linear-gradient(120deg, #fccb90 0%, #d57eeb 100%); -} - -/*016 Deep Blue*/ -.deep_blue{ - background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%); -} - -/*017 Ripe Malinka*/ -.ripe_malinka{ - background-image: linear-gradient(120deg, #f093fb 0%, #f5576c 100%); -} - -/*018 Cloudy Knoxville*/ -.cloudy_knoxville{ - background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%); -} - -/*019 Malibu Beach*/ -.malibu_beach{ - background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 100%); -} - -/*020 New Life*/ -.new_life{ - background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%); -} - -/*021 True Sunset*/ -.true_sunset{ - background-image: linear-gradient(to right, #fa709a 0%, #fee140 100%); -} - -/*022 Morpheus Den*/ -.morpheus_den{ - background-image: linear-gradient(to top, #30cfd0 0%, #330867 100%); -} - -/*023 Rare Wind*/ -.rare_wind{ - background-image: linear-gradient(to top, #a8edea 0%, #fed6e3 100%); -} - -/*024 Near Moon*/ -.near_moon{ - background-image: linear-gradient(to top, #5ee7df 0%, #b490ca 100%); -} - -/*025 Wild Apple*/ -.wild_apple{ - background-image: linear-gradient(to top, #d299c2 0%, #fef9d7 100%); -} - -/*026 Saint Petersburg*/ -.saint_petersburg{ - background-image: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); -} - -/*027 Arielle's Smile*/ -.arielles_smile{ - background-image: radial-gradient(circle 248px at center, #16d9e3 0%, #30c7ec 47%, #46aef7 100%); -} - -/*028 Plum Plate*/ -.plum_plate{ - background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -} - -/*029 Everlasting Sky*/ -.everlasting_sky{ - background-image: linear-gradient(135deg, #fdfcfb 0%, #e2d1c3 100%); -} - -/*030 Happy Fisher*/ -.happy_fisher{ - background-image: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%); -} - -/*031 Blessing*/ -.blessing{ - background-image: linear-gradient(to top, #fddb92 0%, #d1fdff 100%); -} - -/*032 Sharpeye Eagle*/ -.sharpeye_eagle{ - background-image: linear-gradient(to top, #9890e3 0%, #b1f4cf 100%); -} - -/*033 Ladoga Bottom*/ -.ladoga_bottom{ - background-image: linear-gradient(to top, #ebc0fd 0%, #d9ded8 100%); -} - -/*034 Lemon Gate*/ -.lemon_gate{ - background-image: linear-gradient(to top, #96fbc4 0%, #f9f586 100%); -} - -/*035 Itmeo Branding*/ -.itmeo_branding{ - background-image: linear-gradient(180deg, #2af598 0%, #009efd 100%); -} - -/*036 Zeus Miracle*/ -.zeus_miracle{ - background-image: linear-gradient(to top, #cd9cf2 0%, #f6f3ff 100%); -} - -/*037 Old Hat*/ -.old_hat{ - background-image: linear-gradient(to right, #e4afcb 0%, #b8cbb8 0%, #b8cbb8 0%, #e2c58b 30%, #c2ce9c 64%, #7edbdc 100%); -} - -/*038 Star Wine*/ -.star_wine{ - background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%); -} - -/*039 Deep Blue*/ -.deep_blue{ - background-image: linear-gradient(to right, #6a11cb 0%, #2575fc 100%); -} - -/*040 Coup de Grace*/ -.coup_de_grace{ - background: #DCD9D4 linear-gradient(to bottom, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), radial-gradient(at 50% 0%, rgba(255, 255, 255, 0.10) 0%, rgba(0, 0, 0, 0.50) 50%); - background-blend-mode: soft-light,screen; -} - -/*041 Happy Acid*/ -.happy_acid{ - background-image: linear-gradient(to top, #37ecba 0%, #72afd3 100%); -} - -/*042 Awesome Pine*/ -.awesome_pine{ - background-image: linear-gradient(to top, #ebbba7 0%, #cfc7f8 100%); -} - -/*043 New York*/ -.new_york{ - background-image: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%); -} - -/*044 Shy Rainbow*/ -.shy_rainbow{ - background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%); -} - -/*045 Loon Crest*/ -.loon_crest{ - background: linear-gradient(to bottom, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.15) 100%), radial-gradient(at top center, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.40) 120%) #989898; - background-blend-mode: multiply,multiply; -} - -/*046 Mixed Hopes*/ -.mixed_hopes{ - background-image: linear-gradient(to top, #c471f5 0%, #fa71cd 100%); -} - -/*047 Fly High*/ -.fly_high{ - background-image: linear-gradient(to top, #48c6ef 0%, #6f86d6 100%); -} - -/*048 Strong Bliss*/ -.strong_bliss{ - background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%); -} - -/*049 Fresh Milk*/ -.fresh_milk{ - background-image: linear-gradient(to top, #feada6 0%, #f5efef 100%); -} - -/*050 Snow Again*/ -.snow_again{ - background-image: linear-gradient(to top, #e6e9f0 0%, #eef1f5 100%); -} - -/*051 February Ink*/ -.february_ink{ - background-image: linear-gradient(to top, #accbee 0%, #e7f0fd 100%); -} - -/*052 Kind Steel*/ -.kind_steel{ - background-image: linear-gradient(-20deg, #e9defa 0%, #fbfcdb 100%); -} - -/*053 Soft Grass*/ -.soft_grass{ - background-image: linear-gradient(to top, #c1dfc4 0%, #deecdd 100%); -} - -/*054 Grown Early*/ -.grown_early{ - background-image: linear-gradient(to top, #0ba360 0%, #3cba92 100%); -} - -/*055 Sharp Blues*/ -.sharp_blues{ - background-image: linear-gradient(to top, #00c6fb 0%, #005bea 100%); -} - -/*056 Shady Water*/ -.shady_water{ - background-image: linear-gradient(to right, #74ebd5 0%, #9face6 100%); -} - -/*057 Dirty Beauty*/ -.dirty_beauty{ - background-image: linear-gradient(to top, #6a85b6 0%, #bac8e0 100%); -} - -/*058 Great Whale*/ -.great_whale{ - background-image: linear-gradient(to top, #a3bded 0%, #6991c7 100%); -} - -/*059 Teen Notebook*/ -.teen_notebook{ - background-image: linear-gradient(to top, #9795f0 0%, #fbc8d4 100%); -} - -/*060 Polite Rumors*/ -.polite_rumors{ - background-image: linear-gradient(to top, #a7a6cb 0%, #8989ba 52%, #8989ba 100%); -} - -/*061 Sweet Period*/ -.sweet_period{ - background-image: linear-gradient(to top, #3f51b1 0%, #5a55ae 13%, #7b5fac 25%, #8f6aae 38%, #a86aa4 50%, #cc6b8e 62%, #f18271 75%, #f3a469 87%, #f7c978 100%); -} - -/*062 Wide Matrix*/ -.wide_matrix{ - background-image: linear-gradient(to top, #fcc5e4 0%, #fda34b 15%, #ff7882 35%, #c8699e 52%, #7046aa 71%, #0c1db8 87%, #020f75 100%); -} - -/*063 Soft Cherish*/ -.soft_cherish{ - background-image: linear-gradient(to top, #dbdcd7 0%, #dddcd7 24%, #e2c9cc 30%, #e7627d 46%, #b8235a 59%, #801357 71%, #3d1635 84%, #1c1a27 100%); -} - -/*064 Red Salvation*/ -.red_salvation{ - background-image: linear-gradient(to top, #f43b47 0%, #453a94 100%); -} - -/*065 Burning Spring*/ -.burning_spring{ - background-image: linear-gradient(to top, #4fb576 0%, #44c489 30%, #28a9ae 46%, #28a2b7 59%, #4c7788 71%, #6c4f63 86%, #432c39 100%); -} - -/*066 Night Party*/ -.night_party{ - background-image: linear-gradient(to top, #0250c5 0%, #d43f8d 100%); -} - -/*067 Sky Glider*/ -.sky_glider{ - background-image: linear-gradient(to top, #88d3ce 0%, #6e45e2 100%); -} - -/*068 Heaven Peach*/ -.heaven_peach{ - background-image: linear-gradient(to top, #d9afd9 0%, #97d9e1 100%); -} - -/*069 Purple Division*/ -.purple_division{ - background-image: linear-gradient(to top, #7028e4 0%, #e5b2ca 100%); -} - -/*070 Aqua Splash*/ -.aqua_splash{ - background-image: linear-gradient(15deg, #13547a 0%, #80d0c7 100%); -} - -/*071 Above Clouds*/ -.above_clouds{ - background-image: linear-gradient(to left, #BDBBBE 0%, #9D9EA3 100%), radial-gradient(88% 271%, rgba(255, 255, 255, 0.25) 0%, rgba(254, 254, 254, 0.25) 1%, rgba(0, 0, 0, 0.25) 100%), radial-gradient(50% 100%, rgba(255, 255, 255, 0.30) 0%, rgba(0, 0, 0, 0.30) 100%); - background-blend-mode: normal, lighten, soft-light; -} - -/*072 Spiky Naga*/ -.spiky_naga{ - background-image: linear-gradient(to top, #505285 0%, #585e92 12%, #65689f 25%, #7474b0 37%, #7e7ebb 50%, #8389c7 62%, #9795d4 75%, #a2a1dc 87%, #b5aee4 100%); -} - -/*073 Love Kiss*/ -.love_kiss{ - background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%); -} - -/*074 Sharp Glass*/ -.sharp_glass{ - background: #C9CCD3 linear-gradient(-180deg, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%); - background-blend-mode: lighten; -} - -/*075 Clean Mirror*/ -.clean_mirror{ - background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%); -} - -/*076 Premium Dark*/ -.premium_dark{ - background-image: linear-gradient(to right, #434343 0%, black 100%); -} - -/*077 Cold Evening*/ -.cold_evening{ - background-image: linear-gradient(to top, #0c3483 0%, #a2b6df 100%, #6b8cce 100%, #a2b6df 100%); -} - -/*078 Cochiti Lake*/ -.cochiti_lake{ - background-image: linear-gradient(45deg, #93a5cf 0%, #e4efe9 100%); -} - -/*079 Summer Games*/ -.summer_games{ - background-image: linear-gradient(to right, #92fe9d 0%, #00c9ff 100%); -} - -/*080 Passionate Bed*/ -.passionate_bed{ - background-image: linear-gradient(to right, #ff758c 0%, #ff7eb3 100%); -} - -/*081 Mountain Rock*/ -.mountain_rock{ - background-image: linear-gradient(to right, #868f96 0%, #596164 100%); -} - -/*082 Desert Hump*/ -.desert_hump{ - background-image: linear-gradient(to top, #c79081 0%, #dfa579 100%); -} - -/*083 Jungle Day*/ -.jungle_day{ - background-image: linear-gradient(45deg, #8baaaa 0%, #ae8b9c 100%); -} - -/*084 Phoenix Start*/ -.phoenix_start{ - background-image: linear-gradient(to right, #f83600 0%, #f9d423 100%); -} - -/*085 October Silence*/ -.october_silence{ - background-image: linear-gradient(-20deg, #b721ff 0%, #21d4fd 100%); -} - -/*086 Faraway River*/ -.faraway_river{ - background-image: linear-gradient(-20deg, #6e45e2 0%, #88d3ce 100%); -} - -/*087 Alchemist Lab*/ -.alchemist_lab{ - background-image: linear-gradient(-20deg, #d558c8 0%, #24d292 100%); -} - -/*088 Over Sun*/ -.over_sun{ - background-image: linear-gradient(60deg, #abecd6 0%, #fbed96 100%); -} - -/*089 Premium White*/ -.premium_white{ - background-image: linear-gradient(to top, #d5d4d0 0%, #d5d4d0 1%, #eeeeec 31%, #efeeec 75%, #e9e9e7 100%); -} - -/*090 Mars Party*/ -.mars_party{ - background-image: linear-gradient(to top, #5f72bd 0%, #9b23ea 100%); -} - -/*091 Eternal Constance*/ -.eternal_constance{ - background-image: linear-gradient(to top, #09203f 0%, #537895 100%); -} - -/*092 Japan Blush*/ -.japan_blush{ - background-image: linear-gradient(-20deg, #ddd6f3 0%, #faaca8 100%, #faaca8 100%); -} - -/*093 Smiling Rain*/ -.smiling_rain{ - background-image: linear-gradient(-20deg, #dcb0ed 0%, #99c99c 100%); -} - -/*094 Cloudy Apple*/ -.cloudy_apple{ - background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%); -} - -/*095 Big Mango*/ -.big_mango{ - background-image: linear-gradient(to top, #c71d6f 0%, #d09693 100%); -} - -/*096 Healthy Water*/ -.healthy_water{ - background-image: linear-gradient(60deg, #96deda 0%, #50c9c3 100%); -} - -/*097 Amour Amour*/ -.amour_amour{ - background-image: linear-gradient(to top, #f77062 0%, #fe5196 100%); -} - -/*098 Risky Concrete*/ -.risky_concrete{ - background-image: linear-gradient(to top, #c4c5c7 0%, #dcdddf 52%, #ebebeb 100%); -} - -/*099 Strong Stick*/ -.strong_stick{ - background-image: linear-gradient(to right, #a8caba 0%, #5d4157 100%); -} - -/*100 Vicious Stance*/ -.vicious_stance{ - background-image: linear-gradient(60deg, #29323c 0%, #485563 100%); -} - -/*101 Palo Alto*/ -.palo_alto{ - background-image: linear-gradient(-60deg, #16a085 0%, #f4d03f 100%); -} - -/*102 Happy Memories*/ -.happy_memories{ - background-image: linear-gradient(-60deg, #ff5858 0%, #f09819 100%); -} - -/*103 Midnight Bloom*/ -.midnight_bloom{ - background-image: linear-gradient(-20deg, #2b5876 0%, #4e4376 100%); -} - -/*104 Crystalline*/ -.crystalline{ - background-image: linear-gradient(-20deg, #00cdac 0%, #8ddad5 100%); -} - -/*105 Raccoon Back*/ -.raccoon_back{ - background: linear-gradient(-180deg, #BCC5CE 0%, #929EAD 98%), radial-gradient(at top left, rgba(255,255,255,0.30) 0%, rgba(0,0,0,0.30) 100%); - background-blend-mode: screen; -} - -/*106 Party Bliss*/ -.party_bliss{ - background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%); -} - -/*107 Confident Cloud*/ -.confident_cloud{ - background-image: linear-gradient(to top, #dad4ec 0%, #dad4ec 1%, #f3e7e9 100%); -} - -/*108 Le Cocktail*/ -.le_cocktail{ - background-image: linear-gradient(45deg, #874da2 0%, #c43a30 100%); -} - -/*109 River City*/ -.river_city{ - background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%); -} - -/*110 Frozen Berry*/ -.frozen_berry{ - background-image: linear-gradient(to top, #e8198b 0%, #c7eafd 100%); -} - -/*111 Elegance*/ -.elegance{ - background-image: radial-gradient(73% 147%, #EADFDF 59%, #ECE2DF 100%), radial-gradient(91% 146%, rgba(255,255,255,0.50) 47%, rgba(0,0,0,0.50) 100%); - background-blend-mode: screen; -} - -/*112 Child Care*/ -.child_care{ - background-image: linear-gradient(-20deg, #f794a4 0%, #fdd6bd 100%); -} - -/*113 Flying Lemon*/ -.flying_lemon{ - background-image: linear-gradient(60deg, #64b3f4 0%, #c2e59c 100%); -} - -/*114 New Retrowave*/ -.new_retrowave{ - background-image: linear-gradient(to top, #3b41c5 0%, #a981bb 49%, #ffc8a9 100%); -} - -/*115 Hidden Jaguar*/ -.hidden_jaguar{ - background-image: linear-gradient(to top, #0fd850 0%, #f9f047 100%); -} - -/*116 Above The Sky*/ -.above_the_sky{ - background-image: linear-gradient(to top, lightgrey 0%, lightgrey 1%, #e0e0e0 26%, #efefef 48%, #d9d9d9 75%, #bcbcbc 100%); -} - -/*117 Nega*/ -.nega{ - background-image: linear-gradient(45deg, #ee9ca7 0%, #ffdde1 100%); -} - -/*118 Dense Water*/ -.dense_water{ - background-image: linear-gradient(to right, #3ab5b0 0%, #3d99be 31%, #56317a 100%); -} - -/*119 Chemic Aqua*/ -.chemic_aqua{ - background: #CDDCDC radial-gradient(at 50% 100%, rgba(255, 255, 255, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%), linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(0, 0, 0, 0.25) 100%); - background-blend-mode: screen, overlay; -} - -/*120 Seashore*/ -.seashore{ - background-image: linear-gradient(to top, #209cff 0%, #68e0cf 100%); -} - -/*121 Marble Wall*/ -.marble_wall{ - background-image: linear-gradient(to top, #bdc2e8 0%, #bdc2e8 1%, #e6dee9 100%); -} - -/*122 Cheerful Caramel*/ -.cheerful_caramel{ - background-image: linear-gradient(to top, #e6b980 0%, #eacda3 100%); -} - -/*123 Night Sky*/ -.night_sky{ - background-image: linear-gradient(to top, #1e3c72 0%, #1e3c72 1%, #2a5298 100%); -} - -/*124 Magic Lake*/ -.magic_lake{ - background-image: linear-gradient(to top, #d5dee7 0%, #ffafbd 0%, #c9ffbf 100%); -} - -/*125 Young Grass*/ -.young_grass{ - background-image: linear-gradient(to top, #9be15d 0%, #00e3ae 100%); -} - -/*126 Colorful Peach*/ -.colorful_peach{ - background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%); -} - -/*127 Gentle Care*/ -.gentle_care{ - background-image: linear-gradient(to right, #ffc3a0 0%, #ffafbd 100%); -} - -/*128 Plum Bath*/ -.plum_bath{ - background-image: linear-gradient(to top, #cc208e 0%, #6713d2 100%); -} - -/*129 Happy Unicorn*/ -.happy_unicorn{ - background-image: linear-gradient(to top, #b3ffab 0%, #12fff7 100%); -} - -/*130 Full Metal*/ -.full_metal{ - background: linear-gradient(to bottom, #D5DEE7 0%, #E8EBF2 50%, #E2E7ED 100%), linear-gradient(to bottom, rgba(0,0,0,0.02) 50%, rgba(255,255,255,0.02) 61%, rgba(0,0,0,0.02) 73%), linear-gradient(33deg, rgba(255,255,255,0.20) 0%, rgba(0,0,0,0.20) 100%); - background-blend-mode: normal,color-burn; -} - -/*131 African Field*/ -.african_field{ - background-image: linear-gradient(to top, #65bd60 0%, #5ac1a8 25%, #3ec6ed 50%, #b7ddb7 75%, #fef381 100%); -} - -/*132 Solid Stone*/ -.solid_stone{ - background-image: linear-gradient(to right, #243949 0%, #517fa4 100%); -} - -/*133 Orange Juice*/ -.orange_juice{ - background-image: linear-gradient(-20deg, #fc6076 0%, #ff9a44 100%); -} - -/*134 Glass Water*/ -.glass_water{ - background-image: linear-gradient(to top, #dfe9f3 0%, white 100%); -} - -/*135 Slick Carbon*/ -.slick_carbon{ - background: linear-gradient(to bottom, #323232 0%, #3F3F3F 40%, #1C1C1C 150%), linear-gradient(to top, rgba(255,255,255,0.40) 0%, rgba(0,0,0,0.25) 200%); - background-blend-mode: multiply; -} - -/*136 North Miracle*/ -.north_miracle{ - background-image: linear-gradient(to right, #00dbde 0%, #fc00ff 100%); -} - -/*137 Fruit Blend*/ -.fruit_blend{ - background-image: linear-gradient(to right, #f9d423 0%, #ff4e50 100%); -} - -/*138 Millennium Pine*/ -.millennium_pine{ - background-image: linear-gradient(to top, #50cc7f 0%, #f5d100 100%); -} - -/*139 High Flight*/ -.high_flight{ - background-image: linear-gradient(to right, #0acffe 0%, #495aff 100%); -} - -/*140 Mole Hall*/ -.mole_hall{ - background-image: linear-gradient(-20deg, #616161 0%, #9bc5c3 100%); -} - -/*141 Earl Gray*/ -.earl_gray{ - background: #E4E4E1 radial-gradient(at top center, rgba(255, 255, 255, 0.03) 0%, rgba(0, 0, 0, 0.03) 100%), linear-gradient(to top, rgba(255, 255, 255, 0.1) 0%, rgba(143, 152, 157, 0.60) 100%); - background-blend-mode: normal, multiply; -} - -/*142 Space Shift*/ -.space_shift{ - background-image: linear-gradient(60deg, #3d3393 0%, #2b76b9 37%, #2cacd1 65%, #35eb93 100%); -} - -/*143 Forest Inei*/ -.forest_inei{ - background-image: linear-gradient(to top, #df89b5 0%, #bfd9fe 100%); -} - -/*144 Royal Garden*/ -.royal_garden{ - background-image: linear-gradient(to right, #ed6ea0 0%, #ec8c69 100%); -} - -/*145 Rich Metal*/ -.rich_metal{ - background-image: linear-gradient(to right, #d7d2cc 0%, #304352 100%); -} - -/*146 Juicy Cake*/ -.juicy_cake{ - background-image: linear-gradient(to top, #e14fad 0%, #f9d423 100%); -} - -/*147 Smart Indigo*/ -.smart_indigo{ - background-image: linear-gradient(to top, #b224ef 0%, #7579ff 100%); -} - -/*148 Sand Strike*/ -.sand_strike{ - background-image: linear-gradient(to right, #c1c161 0%, #c1c161 0%, #d4d4b1 100%); -} - -/*149 Norse Beauty*/ -.norse_beauty{ - background-image: linear-gradient(to right, #ec77ab 0%, #7873f5 100%); -} - -/*150 Aqua Guidance*/ -.aqua_guidance{ - background-image: linear-gradient(to top, #007adf 0%, #00ecbc 100%); -} - -/*151 Sun Veggie*/ -.sun_veggie{ - background-image: linear-gradient(-225deg, #20E2D7 0%, #F9FEA5 100%); -} - -/*152 Sea Lord*/ -.sea_lord{ - background-image: linear-gradient(-225deg, #2CD8D5 0%, #C5C1FF 56%, #FFBAC3 100%); -} - -/*153 Black Sea*/ -.black_sea{ - background-image: linear-gradient(-225deg, #2CD8D5 0%, #6B8DD6 48%, #8E37D7 100%); -} - -/*154 Grass Shampoo*/ -.grass_shampoo{ - background-image: linear-gradient(-225deg, #DFFFCD 0%, #90F9C4 48%, #39F3BB 100%); -} - -/*155 Landing Aircraft*/ -.landing_aircraft{ - background-image: linear-gradient(-225deg, #5D9FFF 0%, #B8DCFF 48%, #6BBBFF 100%); -} - -/*156 Witch Dance*/ -.witch_dance{ - background-image: linear-gradient(-225deg, #A8BFFF 0%, #884D80 100%); -} - -/*157 Sleepless Night*/ -.sleepless_night{ - background-image: linear-gradient(-225deg, #5271C4 0%, #B19FFF 48%, #ECA1FE 100%); -} - -/*158 Angel Care*/ -.angel_care{ - background-image: linear-gradient(-225deg, #FFE29F 0%, #FFA99F 48%, #FF719A 100%); -} - -/*159 Crystal River*/ -.crystal_river{ - background-image: linear-gradient(-225deg, #22E1FF 0%, #1D8FE1 48%, #625EB1 100%); -} - -/*160 Soft Lipstick*/ -.soft_lipstick{ - background-image: linear-gradient(-225deg, #B6CEE8 0%, #F578DC 100%); -} - -/*161 Salt Mountain*/ -.salt_mountain{ - background-image: linear-gradient(-225deg, #FFFEFF 0%, #D7FFFE 100%); -} - -/*162 Perfect White*/ -.perfect_white{ - background-image: linear-gradient(-225deg, #E3FDF5 0%, #FFE6FA 100%); -} - -/*163 Fresh Oasis*/ -.fresh_oasis{ - background-image: linear-gradient(-225deg, #7DE2FC 0%, #B9B6E5 100%); -} - -/*164 Strict November*/ -.strict_november{ - background-image: linear-gradient(-225deg, #CBBACC 0%, #2580B3 100%); -} - -/*165 Morning Salad*/ -.morning_salad{ - background-image: linear-gradient(-225deg, #B7F8DB 0%, #50A7C2 100%); -} - -/*166 Deep Relief*/ -.deep_relief{ - background-image: linear-gradient(-225deg, #7085B6 0%, #87A7D9 50%, #DEF3F8 100%); -} - -/*167 Sea Strike*/ -.sea_strike{ - background-image: linear-gradient(-225deg, #77FFD2 0%, #6297DB 48%, #1EECFF 100%); -} - -/*168 Night Call*/ -.night_call{ - background-image: linear-gradient(-225deg, #AC32E4 0%, #7918F2 48%, #4801FF 100%); -} - -/*169 Supreme Sky*/ -.supreme_sky{ - background-image: linear-gradient(-225deg, #D4FFEC 0%, #57F2CC 48%, #4596FB 100%); -} - -/*170 Light Blue*/ -.light_blue{ - background-image: linear-gradient(-225deg, #9EFBD3 0%, #57E9F2 48%, #45D4FB 100%); -} - -/*171 Mind Crawl*/ -.mind_crawl{ - background-image: linear-gradient(-225deg, #473B7B 0%, #3584A7 51%, #30D2BE 100%); -} - -/*172 Lily Meadow*/ -.lily_meadow{ - background-image: linear-gradient(-225deg, #65379B 0%, #886AEA 53%, #6457C6 100%); -} - -/*173 Sugar Lollipop*/ -.sugar_lollipop{ - background-image: linear-gradient(-225deg, #A445B2 0%, #D41872 52%, #FF0066 100%); -} - -/*174 Sweet Dessert*/ -.sweet_dessert{ - background-image: linear-gradient(-225deg, #7742B2 0%, #F180FF 52%, #FD8BD9 100%); -} - -/*175 Magic Ray*/ -.magic_ray{ - background-image: linear-gradient(-225deg, #FF3CAC 0%, #562B7C 52%, #2B86C5 100%); -} - -/*176 Teen Party*/ -.teen_party{ - background-image: linear-gradient(-225deg, #FF057C 0%, #8D0B93 50%, #321575 100%); -} - -/*177 Frozen Heat*/ -.frozen_heat{ - background-image: linear-gradient(-225deg, #FF057C 0%, #7C64D5 48%, #4CC3FF 100%); -} - -/*178 Gagarin View*/ -.gagarin_view{ - background-image: linear-gradient(-225deg, #69EACB 0%, #EACCF8 48%, #6654F1 100%); -} - -/*179 Fabled Sunset*/ -.fabled_sunset{ - background-image: linear-gradient(-225deg, #231557 0%, #44107A 29%, #FF1361 67%, #FFF800 100%); -} - -/*180 Perfect Blue*/ -.perfect_blue{ - background-image: linear-gradient(-225deg, #3D4E81 0%, #5753C9 48%, #6E7FF3 100%); -} -- cgit v1.2.3 From 127533637e4ff4d3301fe02c88a2a506dd24c199 Mon Sep 17 00:00:00 2001 From: James McDonnell Date: Wed, 30 Oct 2019 10:22:07 -0400 Subject: Provide repeat parameter to handleExtendedKeyEvent QtWayland uses this to discard key repeats. Modifier key repeats confuse xkbcommon. Change-Id: I3ea384aa7b750ff83520bfb2440e61b91bb6e354 Reviewed-by: Dan Cape Reviewed-by: Johan Helsing --- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index a9b5860187..e3a6aea99f 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -257,7 +257,7 @@ void QQnxScreenEventHandler::injectKeyboardEvent(int flags, int sym, int modifie capKeyString(cap, modifiers, key); QWindowSystemInterface::handleExtendedKeyEvent(QGuiApplication::focusWindow(), type, key, qtMod, - scan, virtualKey, modifiers, keyStr); + scan, virtualKey, modifiers, keyStr, flags & KEY_REPEAT); qScreenEventDebug() << "Qt key t=" << type << ", k=" << key << ", s=" << keyStr; } -- cgit v1.2.3 From d6266c757d2f2ea4ff1e71dc8545f9bf97aa3bb1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 6 Dec 2019 13:19:37 +0100 Subject: Replace usages of QVariant::value by qvariant_cast This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll --- src/corelib/kernel/qvariant.cpp | 2 +- src/corelib/kernel/qvariant.h | 6 +++--- src/corelib/serialization/qjsoncbor.cpp | 8 ++++---- src/corelib/serialization/qjsonvalue.cpp | 6 +++--- src/corelib/text/qlocale.cpp | 2 +- src/corelib/text/qlocale_unix.cpp | 4 ++-- src/dbus/qdbusinterface.cpp | 14 +++++++------- src/gui/image/qimagereader.cpp | 2 +- src/gui/image/qimagewriter.cpp | 2 +- src/gui/text/qfontengine_qpf2.cpp | 16 ++++++++-------- src/gui/text/qsyntaxhighlighter.cpp | 2 +- src/gui/util/qshadergenerator.cpp | 4 ++-- src/network/access/qnetworkreplyhttpimpl.cpp | 2 +- .../eglconvenience/qeglplatformcontext.cpp | 2 +- .../linuxaccessibility/atspiadaptor.cpp | 2 +- .../themes/genericunix/dbusmenu/qdbusmenutypes.cpp | 2 +- .../bearer/networkmanager/qnetworkmanagerengine.cpp | 2 +- .../bearer/networkmanager/qnetworkmanagerservice.cpp | 16 ++++++++-------- .../ibus/qibusplatforminputcontext.cpp | 4 ++-- src/plugins/platforminputcontexts/ibus/qibusproxy.cpp | 4 ++-- src/plugins/platforminputcontexts/ibus/qibustypes.cpp | 6 +++--- .../xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- src/plugins/printsupport/cups/qcupsprintengine.cpp | 4 ++-- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 14 +++++++------- src/printsupport/dialogs/qprintdialog_unix.cpp | 18 +++++++++--------- src/printsupport/kernel/qcups.cpp | 2 +- src/printsupport/kernel/qprintengine_pdf.cpp | 6 +++--- src/printsupport/kernel/qprinter.cpp | 2 +- src/printsupport/widgets/qcupsjobwidget.cpp | 6 +++--- src/testlib/qabstractitemmodeltester.cpp | 2 +- src/widgets/dialogs/qdialog.cpp | 2 +- src/widgets/styles/qfusionstyle.cpp | 2 +- src/widgets/util/qscrollerproperties.cpp | 6 +++--- src/widgets/widgets/qcombobox.cpp | 2 +- 35 files changed, 89 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index c00efc0afe..f3ac3fcdba 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1544,7 +1544,7 @@ static void customStreamDebug(QDebug dbg, const QVariant &variant) { #ifndef QT_BOOTSTRAPPED QMetaType::TypeFlags flags = QMetaType::typeFlags(variant.userType()); if (flags & QMetaType::PointerToQObject) - dbg.nospace() << variant.value(); + dbg.nospace() << qvariant_cast(variant); #else Q_UNUSED(dbg); Q_UNUSED(variant); diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 0dddfc59b3..0ffac5ad54 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -779,7 +779,7 @@ namespace QtPrivate { return QSequentialIterable(QtMetaTypePrivate::QSequentialIterableImpl(reinterpret_cast(v.constData()))); } #endif - return QSequentialIterable(v.value()); + return QSequentialIterable(qvariant_cast(v)); } }; template<> @@ -794,7 +794,7 @@ namespace QtPrivate { if (typeId == qMetaTypeId()) { return QAssociativeIterable(QtMetaTypePrivate::QAssociativeIterableImpl(reinterpret_cast(v.constData()))); } - return QAssociativeIterable(v.value()); + return QAssociativeIterable(qvariant_cast(v)); } }; template<> @@ -857,7 +857,7 @@ namespace QtPrivate { return QVariantValueHelper >::invoke(v); if (QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId())) { - QtMetaTypePrivate::QPairVariantInterfaceImpl pi = v.value(); + QtMetaTypePrivate::QPairVariantInterfaceImpl pi = qvariant_cast(v); const QtMetaTypePrivate::VariantData d1 = pi.first(); QVariant v1(d1.metaTypeId, d1.data, d1.flags); diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp index 7136a163ee..5097f4eb81 100644 --- a/src/corelib/serialization/qjsoncbor.cpp +++ b/src/corelib/serialization/qjsoncbor.cpp @@ -757,13 +757,13 @@ QCborValue QCborValue::fromVariant(const QVariant &variant) return QCborMap::fromJsonObject(doc.object()); } case QMetaType::QCborValue: - return variant.value(); + return qvariant_cast(variant); case QMetaType::QCborArray: - return variant.value(); + return qvariant_cast(variant); case QMetaType::QCborMap: - return variant.value(); + return qvariant_cast(variant); case QMetaType::QCborSimpleType: - return variant.value(); + return qvariant_cast(variant); #endif default: break; diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index 033e438580..6cf4c7fdf9 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -482,11 +482,11 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant) return doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object()); } case QMetaType::QCborValue: - return variant.value().toJsonValue(); + return qvariant_cast(variant).toJsonValue(); case QMetaType::QCborArray: - return variant.value().toJsonArray(); + return qvariant_cast(variant).toJsonArray(); case QMetaType::QCborMap: - return variant.value().toJsonObject(); + return qvariant_cast(variant).toJsonObject(); #endif default: break; diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 694d491273..bc38437f8e 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -3065,7 +3065,7 @@ QList QLocale::weekdays() const if (d->m_data == systemData()) { QVariant res = systemLocale()->query(QSystemLocale::Weekdays, QVariant()); if (!res.isNull()) - return static_cast >(res.value >()); + return static_cast >(qvariant_cast >(res)); } #endif QList weekdays; diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index ff4274d932..5e1e47eae7 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -283,9 +283,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return d->uiLanguages.isEmpty() ? QVariant() : QVariant(d->uiLanguages); } case StringToStandardQuotation: - return lc_messages.quoteString(in.value()); + return lc_messages.quoteString(qvariant_cast(in)); case StringToAlternateQuotation: - return lc_messages.quoteString(in.value(), QLocale::AlternateQuotation); + return lc_messages.quoteString(qvariant_cast(in), QLocale::AlternateQuotation); case ListToSeparatedString: return lc_messages.createSeparatedList(in.toStringList()); case LocaleChanged: diff --git a/src/dbus/qdbusinterface.cpp b/src/dbus/qdbusinterface.cpp index 72b9d42247..fb958a8954 100644 --- a/src/dbus/qdbusinterface.cpp +++ b/src/dbus/qdbusinterface.cpp @@ -60,15 +60,15 @@ static void copyArgument(void *to, int id, const QVariant &arg) return; case QMetaType::UChar: - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; case QMetaType::Short: - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; case QMetaType::UShort: - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; case QVariant::Int: @@ -105,13 +105,13 @@ static void copyArgument(void *to, int id, const QVariant &arg) } if (id == QDBusMetaTypeId::variant()) { - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; } else if (id == QDBusMetaTypeId::objectpath()) { - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; } else if (id == QDBusMetaTypeId::signature()) { - *reinterpret_cast(to) = arg.value(); + *reinterpret_cast(to) = qvariant_cast(arg); return; } @@ -136,7 +136,7 @@ static void copyArgument(void *to, int id, const QVariant &arg) } // is it the same signature? - QDBusArgument dbarg = arg.value(); + QDBusArgument dbarg = qvariant_cast(arg); if (dbarg.currentSignature() != QLatin1String(userSignature)) { // not the same signature, another mismatch //qWarning? diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 5e3b608d20..6139cf99c9 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1089,7 +1089,7 @@ QList QImageReader::supportedSubTypes() const return QList(); if (d->handler->supportsOption(QImageIOHandler::SupportedSubTypes)) - return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList >(); + return qvariant_cast >(d->handler->option(QImageIOHandler::SupportedSubTypes)); return QList(); } diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 9dcc955fe2..512da5c432 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -561,7 +561,7 @@ QList QImageWriter::supportedSubTypes() const { if (!supportsOption(QImageIOHandler::SupportedSubTypes)) return QList(); - return d->handler->option(QImageIOHandler::SupportedSubTypes).value< QList >(); + return qvariant_cast >(d->handler->option(QImageIOHandler::SupportedSubTypes)); } /*! diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index d22239c040..e00f9d058c 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -456,7 +456,7 @@ glyph_metrics_t QFontEngineQPF2::boundingBox(glyph_t glyph) QFixed QFontEngineQPF2::ascent() const { - return QFixed::fromReal(extractHeaderField(fontData, Tag_Ascent).value()); + return QFixed::fromReal(qvariant_cast(extractHeaderField(fontData, Tag_Ascent))); } QFixed QFontEngineQPF2::capHeight() const @@ -466,37 +466,37 @@ QFixed QFontEngineQPF2::capHeight() const QFixed QFontEngineQPF2::descent() const { - return QFixed::fromReal(extractHeaderField(fontData, Tag_Descent).value()); + return QFixed::fromReal(qvariant_cast(extractHeaderField(fontData, Tag_Descent))); } QFixed QFontEngineQPF2::leading() const { - return QFixed::fromReal(extractHeaderField(fontData, Tag_Leading).value()); + return QFixed::fromReal(qvariant_cast(extractHeaderField(fontData, Tag_Leading))); } qreal QFontEngineQPF2::maxCharWidth() const { - return extractHeaderField(fontData, Tag_MaxCharWidth).value(); + return qvariant_cast(extractHeaderField(fontData, Tag_MaxCharWidth)); } qreal QFontEngineQPF2::minLeftBearing() const { - return extractHeaderField(fontData, Tag_MinLeftBearing).value(); + return qvariant_cast(extractHeaderField(fontData, Tag_MinLeftBearing)); } qreal QFontEngineQPF2::minRightBearing() const { - return extractHeaderField(fontData, Tag_MinRightBearing).value(); + return qvariant_cast(extractHeaderField(fontData, Tag_MinRightBearing)); } QFixed QFontEngineQPF2::underlinePosition() const { - return QFixed::fromReal(extractHeaderField(fontData, Tag_UnderlinePosition).value()); + return QFixed::fromReal(qvariant_cast(extractHeaderField(fontData, Tag_UnderlinePosition))); } QFixed QFontEngineQPF2::lineThickness() const { - return QFixed::fromReal(extractHeaderField(fontData, Tag_LineThickness).value()); + return QFixed::fromReal(qvariant_cast(extractHeaderField(fontData, Tag_LineThickness))); } bool QFontEngineQPF2::isValid() const diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index c345e89a21..b50957d63d 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -299,7 +299,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent) : QObject(*new QSyntaxHighlighterPrivate, parent) { if (parent && parent->inherits("QTextEdit")) { - QTextDocument *doc = parent->property("document").value(); + QTextDocument *doc = qvariant_cast(parent->property("document")); if (doc) setDocument(doc); } diff --git a/src/gui/util/qshadergenerator.cpp b/src/gui/util/qshadergenerator.cpp index bcb985de54..4beed8ed25 100644 --- a/src/gui/util/qshadergenerator.cpp +++ b/src/gui/util/qshadergenerator.cpp @@ -273,11 +273,11 @@ namespace const QByteArray placeholder = QByteArray(QByteArrayLiteral("$") + parameterName.toUtf8()); const QVariant parameter = node.parameter(parameterName); if (parameter.userType() == qMetaTypeId()) { - const QShaderLanguage::StorageQualifier qualifier = parameter.value(); + const QShaderLanguage::StorageQualifier qualifier = qvariant_cast(parameter); const QByteArray value = toGlsl(qualifier, format); result.replace(placeholder, value); } else if (parameter.userType() == qMetaTypeId()) { - const QShaderLanguage::VariableType type = parameter.value(); + const QShaderLanguage::VariableType type = qvariant_cast(parameter); const QByteArray value = toGlsl(type); result.replace(placeholder, value); } else { diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index ba9d0a76d5..5a775142b0 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -693,7 +693,7 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq auto redirectPolicy = QNetworkRequest::ManualRedirectPolicy; const QVariant value = newHttpRequest.attribute(QNetworkRequest::RedirectPolicyAttribute); if (value.isValid()) - redirectPolicy = value.value(); + redirectPolicy = qvariant_cast(value); else if (newHttpRequest.attribute(QNetworkRequest::FollowRedirectsAttribute).toBool()) redirectPolicy = QNetworkRequest::NoLessSafeRedirectPolicy; diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index aa87a620d8..63cf771f32 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -218,7 +218,7 @@ void QEGLPlatformContext::adopt(const QVariant &nativeHandle, QPlatformOpenGLCon qWarning("QEGLPlatformContext: Requires a QEGLNativeContext"); return; } - QEGLNativeContext handle = nativeHandle.value(); + QEGLNativeContext handle = qvariant_cast(nativeHandle); EGLContext context = handle.context(); if (!context) { qWarning("QEGLPlatformContext: No EGLContext given"); diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 4a83c6eb80..0f34e1a4ca 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -2230,7 +2230,7 @@ bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString return false; if (function == QLatin1String("SetCurrentValue")) { - QDBusVariant v = message.arguments().at(2).value(); + QDBusVariant v = qvariant_cast(message.arguments().at(2)); double value = v.variant().toDouble(); //Temporary fix //See https://bugzilla.gnome.org/show_bug.cgi?id=652596 diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp index 82a13d2fa0..ccf2180dc5 100644 --- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp +++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenutypes.cpp @@ -152,7 +152,7 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QDBusMenuLayoutItem &i while (!arg.atEnd()) { QDBusVariant dbusVariant; arg >> dbusVariant; - QDBusArgument childArgument = dbusVariant.variant().value(); + QDBusArgument childArgument = qvariant_cast(dbusVariant.variant()); QDBusMenuLayoutItem child; childArgument >> child; diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index e74b1cf744..85a9f9b9e0 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -250,7 +250,7 @@ void QNetworkManagerEngine::interfacePropertiesChanged(const QMap >(i.value().value()); + const auto activeConnections = qdbus_cast >(qvariant_cast(i.value())); QStringList identifiers = accessPointConfigurations.keys(); QStringList priorActiveConnections = activeConnectionsList.keys(); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 35199eb7a2..2d6cba1791 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -193,7 +193,7 @@ QList QNetworkManagerInterface::activeConnections() const { if (propertyMap.contains("ActiveConnections")) { - const QDBusArgument &dbusArgs = propertyMap.value("ActiveConnections").value(); + const QDBusArgument &dbusArgs = qvariant_cast(propertyMap.value("ActiveConnections")); QDBusObjectPath path; QList list; @@ -403,7 +403,7 @@ quint32 QNetworkManagerInterfaceDevice::deviceType() const QDBusObjectPath QNetworkManagerInterfaceDevice::ip4config() const { if (propertyMap.contains("Ip4Config")) - return propertyMap.value("Ip4Config").value(); + return qvariant_cast(propertyMap.value("Ip4Config")); return QDBusObjectPath(); } @@ -411,7 +411,7 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap map) { for (auto i = map.cbegin(), end = map.cend(); i != end; ++i) { if (i.key() == QLatin1String("AvailableConnections")) { //Device - const QDBusArgument &dbusArgs = i.value().value(); + const QDBusArgument &dbusArgs = qvariant_cast(i.value()); QDBusObjectPath path; QStringList paths; dbusArgs.beginArray(); @@ -489,7 +489,7 @@ QStringList QNetworkManagerInterfaceDeviceWired::availableConnections() { QStringList list; if (propertyMap.contains("AvailableConnections")) { - const QDBusArgument &dbusArgs = propertyMap.value("Carrier").value(); + const QDBusArgument &dbusArgs = qvariant_cast(propertyMap.value("Carrier")); QDBusObjectPath path; dbusArgs.beginArray(); while (!dbusArgs.atEnd()) { @@ -598,7 +598,7 @@ quint32 QNetworkManagerInterfaceDeviceWireless::bitrate() const QDBusObjectPath QNetworkManagerInterfaceDeviceWireless::activeAccessPoint() const { if (propertyMap.contains("ActiveAccessPoint")) - return propertyMap.value("ActiveAccessPoint").value(); + return qvariant_cast(propertyMap.value("ActiveAccessPoint")); return QDBusObjectPath(); } @@ -931,14 +931,14 @@ QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive() QDBusObjectPath QNetworkManagerConnectionActive::connection() const { if (propertyMap.contains("Connection")) - return propertyMap.value("Connection").value(); + return qvariant_cast(propertyMap.value("Connection")); return QDBusObjectPath(); } QDBusObjectPath QNetworkManagerConnectionActive::specificObject() const { if (propertyMap.contains("SpecificObject")) - return propertyMap.value("SpecificObject").value(); + return qvariant_cast(propertyMap.value("SpecificObject")); return QDBusObjectPath(); } @@ -946,7 +946,7 @@ QStringList QNetworkManagerConnectionActive::devices() const { QStringList list; if (propertyMap.contains("Devices")) { - const QDBusArgument &dbusArgs = propertyMap.value("Devices").value(); + const QDBusArgument &dbusArgs = qvariant_cast(propertyMap.value("Devices")); QDBusObjectPath path; dbusArgs.beginArray(); diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index f2429f24ff..47ac54927b 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -285,7 +285,7 @@ void QIBusPlatformInputContext::commitText(const QDBusVariant &text) if (!input) return; - const QDBusArgument arg = text.variant().value(); + const QDBusArgument arg = qvariant_cast(text.variant()); QIBusText t; if (debug) @@ -311,7 +311,7 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint if (!input) return; - const QDBusArgument arg = text.variant().value(); + const QDBusArgument arg = qvariant_cast(text.variant()); QIBusText t; arg >> t; diff --git a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp index 156e9b7c90..6b46e106ab 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusproxy.cpp @@ -83,10 +83,10 @@ QIBusEngineDesc QIBusProxy::getGlobalEngine() QVariant variant = reply.value().variant(); if (!variant.isValid()) return desc; - QVariant child = variant.value().variant(); + QVariant child = qvariant_cast(variant).variant(); if (!child.isValid()) return desc; - const QDBusArgument argument = child.value(); + const QDBusArgument argument = qvariant_cast(child); argument >> desc; return desc; } diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp index a2551f1320..443df271a8 100644 --- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp @@ -62,7 +62,7 @@ void QIBusSerializable::deserializeFrom(const QDBusArgument &argument) argument >> key; argument >> value; argument.endMapEntry(); - attachments[key] = value.variant().value(); + attachments[key] = qvariant_cast(value.variant()); } argument.endMap(); } @@ -201,7 +201,7 @@ void QIBusAttributeList::deserializeFrom(const QDBusArgument &arg) arg >> var; QIBusAttribute attr; - var.variant().value() >> attr; + qvariant_cast(var.variant()) >> attr; attributes.append(std::move(attr)); } arg.endArray(); @@ -268,7 +268,7 @@ void QIBusText::deserializeFrom(const QDBusArgument &argument) argument >> text; QDBusVariant variant; argument >> variant; - variant.variant().value() >> attributes; + qvariant_cast(variant.variant()) >> attributes; argument.endStructure(); } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 57805d5571..75189a9c80 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -429,7 +429,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const qWarning("QGLXContext: Requires a QGLXNativeContext"); return; } - QGLXNativeContext handle = nativeHandle.value(); + QGLXNativeContext handle = qvariant_cast(nativeHandle); GLXContext context = handle.context(); if (!context) { qWarning("QGLXContext: No GLXContext given"); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 66030b9ad4..23ed80ab5a 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -930,7 +930,7 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags) QXcbWindowFunctions::WmWindowTypes wmWindowTypes; if (window()->dynamicPropertyNames().contains(wm_window_type_property_id)) { wmWindowTypes = static_cast( - window()->property(wm_window_type_property_id).value()); + qvariant_cast(window()->property(wm_window_type_property_id))); } setWmWindowType(wmWindowTypes, flags); diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp index c9683eb99d..43d5e119ad 100644 --- a/src/plugins/printsupport/cups/qcupsprintengine.cpp +++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp @@ -100,10 +100,10 @@ void QCupsPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &v d->cupsOptions = value.toStringList(); break; case PPK_QPageSize: - d->setPageSize(value.value()); + d->setPageSize(qvariant_cast(value)); break; case PPK_QPageLayout: { - QPageLayout pageLayout = value.value(); + QPageLayout pageLayout = qvariant_cast(value); if (pageLayout.isValid() && (d->m_printDevice.isValidPageLayout(pageLayout, d->resolution) || d->m_printDevice.supportsCustomPageSizes() || d->m_printDevice.supportedPageSizes().isEmpty())) { diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index ab7a2edb67..78e5b8d1ef 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -533,10 +533,10 @@ void QPageSetupWidget::setupPrinter() const { m_printer->setPageLayout(m_pageLayout); #if QT_CONFIG(cups) - QCUPSSupport::PagesPerSheet pagesPerSheet = m_ui.pagesPerSheetCombo->currentData() - .value(); - QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = m_ui.pagesPerSheetLayoutCombo->currentData() - .value(); + QCUPSSupport::PagesPerSheet pagesPerSheet = qvariant_cast(m_ui.pagesPerSheetCombo->currentData() +); + QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = qvariant_cast(m_ui.pagesPerSheetLayoutCombo->currentData() +); QCUPSSupport::setPagesPerSheetLayout(m_printer, pagesPerSheet, pagesPerSheetLayout); #endif #ifdef PSD_ENABLE_PAPERSOURCE @@ -587,11 +587,11 @@ void QPageSetupWidget::pageSizeChanged() { QPageSize pageSize; if (m_ui.pageSizeCombo->currentIndex() != m_realCustomPageSizeIndex) { - pageSize = m_ui.pageSizeCombo->currentData().value(); + pageSize = qvariant_cast(m_ui.pageSizeCombo->currentData()); #if QT_CONFIG(cups) if (m_pageSizePpdOption) { - ppd_file_t *ppd = m_printDevice->property(PDPK_PpdFile).value(); + ppd_file_t *ppd = qvariant_cast(m_printDevice->property(PDPK_PpdFile)); QTextCodec *cupsCodec = QTextCodec::codecForName(ppd->lang_encoding); for (int i = 0; i < m_pageSizePpdOption->num_choices; ++i) { const ppd_choice_t *choice = &m_pageSizePpdOption->choices[i]; @@ -676,7 +676,7 @@ void QPageSetupWidget::unitChanged() { if (m_blockSignals) return; - m_units = m_ui.unitCombo->currentData().value(); + m_units = qvariant_cast(m_ui.unitCombo->currentData()); m_pageLayout.setUnits(m_units); updateWidget(); } diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index d929367557..bf1633930c 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -426,7 +426,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget() { bool anyWidgetCreated = false; - ppd_file_t *ppd = m_currentPrintDevice->property(PDPK_PpdFile).value(); + ppd_file_t *ppd = qvariant_cast(m_currentPrintDevice->property(PDPK_PpdFile)); if (ppd) { m_cupsCodec = QTextCodec::codecForName(ppd->lang_encoding); @@ -532,7 +532,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget() void QPrintPropertiesDialog::setPrinterAdvancedCupsOptions() const { for (const QComboBox *choicesCb : m_advancedOptionsCombos) { - const ppd_option_t *option = choicesCb->property(ppdOptionProperty).value(); + const ppd_option_t *option = qvariant_cast(choicesCb->property(ppdOptionProperty)); // We can't use choicesCb->currentIndex() to know the index of the option in the choices[] array // because some of them may not be present in the list because they conflict with the @@ -551,7 +551,7 @@ void QPrintPropertiesDialog::setPrinterAdvancedCupsOptions() const void QPrintPropertiesDialog::revertAdvancedOptionsToSavedValues() const { for (QComboBox *choicesCb : m_advancedOptionsCombos) { - const int originallySelectedChoice = choicesCb->property(ppdOriginallySelectedChoiceProperty).value(); + const int originallySelectedChoice = qvariant_cast(choicesCb->property(ppdOriginallySelectedChoiceProperty)); const int newComboIndexToSelect = choicesCb->findData(originallySelectedChoice); choicesCb->setCurrentIndex(newComboIndexToSelect); // The currentIndexChanged lambda takes care of resetting the ppd option @@ -580,8 +580,8 @@ bool QPrintPropertiesDialog::anyAdvancedOptionConflict() const bool anyConflicted = false; for (const QComboBox *choicesCb : m_advancedOptionsCombos) { - const ppd_option_t *option = choicesCb->property(ppdOptionProperty).value(); - QLabel *warningLabel = choicesCb->property(warningLabelProperty).value(); + const ppd_option_t *option = qvariant_cast(choicesCb->property(ppdOptionProperty)); + QLabel *warningLabel = qvariant_cast(choicesCb->property(warningLabelProperty)); if (option->conflicted) { anyConflicted = true; const int pixmap_size = choicesCb->sizeHint().height() * .75; @@ -900,7 +900,7 @@ void QPrintDialogPrivate::setupPrinter() // page set if (p->printRange() == QPrinter::AllPages || p->printRange() == QPrinter::PageRange) { //If the application is selecting pages and the first page number is even then need to adjust the odd-even accordingly - QCUPSSupport::PageSet pageSet = options.pageSetCombo->itemData(options.pageSetCombo->currentIndex()).value(); + QCUPSSupport::PageSet pageSet = qvariant_cast(options.pageSetCombo->itemData(options.pageSetCombo->currentIndex())); if (q->isOptionEnabled(QPrintDialog::PrintPageRange) && p->printRange() == QPrinter::PageRange && (q->fromPage() % 2 == 0)) { @@ -1323,10 +1323,10 @@ bool QUnixPrintWidgetPrivate::checkFields() #if QT_CONFIG(cups) if (propertiesDialog) { - QCUPSSupport::PagesPerSheet pagesPerSheet = propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo - ->currentData().value(); + QCUPSSupport::PagesPerSheet pagesPerSheet = qvariant_cast(propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo + ->currentData()); - QCUPSSupport::PageSet pageSet = optionsPane->options.pageSetCombo->currentData().value(); + QCUPSSupport::PageSet pageSet = qvariant_cast(optionsPane->options.pageSetCombo->currentData()); if (pagesPerSheet != QCUPSSupport::OnePagePerSheet diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index 2fc4621960..0fc8cdd1b7 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -149,7 +149,7 @@ QCUPSSupport::JobHoldUntilWithTime QCUPSSupport::parseJobHoldUntil(const QString ppd_option_t *QCUPSSupport::findPpdOption(const char *optionName, QPrintDevice *printDevice) { - ppd_file_t *ppd = printDevice->property(PDPK_PpdFile).value(); + ppd_file_t *ppd = qvariant_cast(printDevice->property(PDPK_PpdFile)); if (ppd) { for (int i = 0; i < ppd->num_groups; ++i) { diff --git a/src/printsupport/kernel/qprintengine_pdf.cpp b/src/printsupport/kernel/qprintengine_pdf.cpp index 3c24e5ac69..7f1c20916b 100644 --- a/src/printsupport/kernel/qprintengine_pdf.cpp +++ b/src/printsupport/kernel/qprintengine_pdf.cpp @@ -217,19 +217,19 @@ void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va break; } case PPK_QPageSize: { - QPageSize pageSize = value.value(); + QPageSize pageSize = qvariant_cast(value); if (pageSize.isValid()) d->m_pageLayout.setPageSize(pageSize); break; } case PPK_QPageMargins: { - QPair pair = value.value >(); + QPair pair = qvariant_cast >(value); d->m_pageLayout.setUnits(pair.second); d->m_pageLayout.setMargins(pair.first); break; } case PPK_QPageLayout: { - QPageLayout pageLayout = value.value(); + QPageLayout pageLayout = qvariant_cast(value); if (pageLayout.isValid()) d->m_pageLayout = pageLayout; break; diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index ddcd8c4702..fbf5e5c2ba 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -294,7 +294,7 @@ public: { QPrinterPrivate *pd = QPrinterPrivate::get(m_printer); - return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value(); + return qvariant_cast(pd->printEngine->property(QPrintEngine::PPK_QPageLayout)); } QPrinter *m_printer; diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp index dcdb933f73..456ed9db19 100644 --- a/src/printsupport/widgets/qcupsjobwidget.cpp +++ b/src/printsupport/widgets/qcupsjobwidget.cpp @@ -150,7 +150,7 @@ void QCupsJobWidget::setJobHold(QCUPSSupport::JobHoldUntil jobHold, const QTime QCUPSSupport::JobHoldUntil QCupsJobWidget::jobHold() const { - return m_ui.jobHoldComboBox->itemData(m_ui.jobHoldComboBox->currentIndex()).value(); + return qvariant_cast(m_ui.jobHoldComboBox->itemData(m_ui.jobHoldComboBox->currentIndex())); } void QCupsJobWidget::toggleJobHoldTime() @@ -247,7 +247,7 @@ void QCupsJobWidget::setStartBannerPage(const QCUPSSupport::BannerPage bannerPag QCUPSSupport::BannerPage QCupsJobWidget::startBannerPage() const { - return m_ui.startBannerPageCombo->itemData(m_ui.startBannerPageCombo->currentIndex()).value(); + return qvariant_cast(m_ui.startBannerPageCombo->itemData(m_ui.startBannerPageCombo->currentIndex())); } void QCupsJobWidget::setEndBannerPage(const QCUPSSupport::BannerPage bannerPage) @@ -257,7 +257,7 @@ void QCupsJobWidget::setEndBannerPage(const QCUPSSupport::BannerPage bannerPage) QCUPSSupport::BannerPage QCupsJobWidget::endBannerPage() const { - return m_ui.endBannerPageCombo->itemData(m_ui.endBannerPageCombo->currentIndex()).value(); + return qvariant_cast(m_ui.endBannerPageCombo->itemData(m_ui.endBannerPageCombo->currentIndex())); } QT_END_NAMESPACE diff --git a/src/testlib/qabstractitemmodeltester.cpp b/src/testlib/qabstractitemmodeltester.cpp index 859966c0e3..2e05097122 100644 --- a/src/testlib/qabstractitemmodeltester.cpp +++ b/src/testlib/qabstractitemmodeltester.cpp @@ -605,7 +605,7 @@ void QAbstractItemModelTesterPrivate::data() // Check that the alignment is one we know about QVariant textAlignmentVariant = model->data(model->index(0, 0), Qt::TextAlignmentRole); if (textAlignmentVariant.isValid()) { - Qt::Alignment alignment = textAlignmentVariant.value(); + Qt::Alignment alignment = qvariant_cast(textAlignmentVariant); MODELTESTER_COMPARE(alignment, (alignment & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask))); } diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 362200a4fd..906022a185 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -920,7 +920,7 @@ void QDialog::adjustPosition(QWidget* w) if (w) { // Use pos() if the widget is embedded into a native window QPoint pp; - if (w->windowHandle() && w->windowHandle()->property("_q_embedded_native_parent_handle").value()) + if (w->windowHandle() && qvariant_cast(w->windowHandle()->property("_q_embedded_native_parent_handle"))) pp = w->pos(); else pp = w->mapToGlobal(QPoint(0,0)); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 03d083bbf1..8da21a2e11 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -2413,7 +2413,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption int oldMin = styleObject->property("_q_stylemin").toInt(); int oldMax = styleObject->property("_q_stylemax").toInt(); QRect oldRect = styleObject->property("_q_stylerect").toRect(); - QStyle::State oldState = static_cast(styleObject->property("_q_stylestate").value()); + QStyle::State oldState = static_cast(qvariant_cast(styleObject->property("_q_stylestate"))); uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt(); // a scrollbar is transient when the the scrollbar itself and diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp index 0306f54faa..be763f182e 100644 --- a/src/widgets/util/qscrollerproperties.cpp +++ b/src/widgets/util/qscrollerproperties.cpp @@ -261,9 +261,9 @@ void QScrollerProperties::setScrollMetric(ScrollMetric metric, const QVariant &v case OvershootDragDistanceFactor: d->overshootDragDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break; case OvershootScrollDistanceFactor: d->overshootScrollDistanceFactor = qBound(qreal(0), value.toReal(), qreal(1)); break; case OvershootScrollTime: d->overshootScrollTime = value.toReal(); break; - case HorizontalOvershootPolicy: d->hOvershootPolicy = value.value(); break; - case VerticalOvershootPolicy: d->vOvershootPolicy = value.value(); break; - case FrameRate: d->frameRate = value.value(); break; + case HorizontalOvershootPolicy: d->hOvershootPolicy = qvariant_cast(value); break; + case VerticalOvershootPolicy: d->vOvershootPolicy = qvariant_cast(value); break; + case FrameRate: d->frameRate = qvariant_cast(value); break; case ScrollMetricCount: break; } } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 4cfa5554e4..d786c7ff83 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -172,7 +172,7 @@ QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewIt // that order, also override the font for the popup menu. QVariant fontRoleData = index.data(Qt::FontRole); if (fontRoleData.isValid()) { - menuOption.font = fontRoleData.value(); + menuOption.font = qvariant_cast(fontRoleData); } else if (mCombo->testAttribute(Qt::WA_SetFont) || mCombo->testAttribute(Qt::WA_MacSmallSize) || mCombo->testAttribute(Qt::WA_MacMiniSize) -- cgit v1.2.3 From 98f19f00361bf25097281cae5dfa833ba7db8a2f Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Sat, 7 Sep 2019 20:05:42 +0200 Subject: Use pkg-config to find libjpeg Change-Id: I42d877fbca5d746114cc28f8ee4db3e54754cd24 Reviewed-by: Thiago Macieira --- src/gui/configure.json | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/configure.json b/src/gui/configure.json index 19312d245d..0202f17b21 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -374,6 +374,7 @@ }, "headers": "jpeglib.h", "sources": [ + { "type": "pkgConfig", "args": "libjpeg" }, { "libs": "-llibjpeg", "condition": "config.msvc" }, "-ljpeg" ] -- cgit v1.2.3 From deeaa500ad8c591b3142eb53a57e79b6b4ae1ca6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 5 Dec 2019 10:44:37 +0100 Subject: Mark the old style unprefixed stream functions deprecated Requires a third definition for the source-compatible but deprecated version. Change-Id: I260ae79f4547f99eed701b10e0b25222f81cd5ff Reviewed-by: Lars Knoll --- src/corelib/serialization/qtextstream.cpp | 52 +++++++++++++++++++++++++------ src/corelib/serialization/qtextstream.h | 42 ++++++++++++++++++------- src/tools/tracegen/etw.cpp | 2 +- 3 files changed, 73 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp index cf59cc54c7..4d92b1e0da 100644 --- a/src/corelib/serialization/qtextstream.cpp +++ b/src/corelib/serialization/qtextstream.cpp @@ -2689,11 +2689,8 @@ QTextStream &QTextStream::operator<<(const void *ptr) d->params.numberFlags = oldFlags; return *this; } -#if defined(Q_QDOC) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + namespace Qt { -#else -namespace QTextStreamFunctions { -#endif /*! \relates QTextStream @@ -3020,7 +3017,7 @@ QTextStream &ws(QTextStream &stream) return stream; } -} // namespace QTextStreamFunctions +} // namespace Qt /*! \fn QTextStreamManipulator qSetFieldWidth(int width) @@ -3045,11 +3042,7 @@ QTextStream &ws(QTextStream &stream) #if QT_CONFIG(textcodec) -#if defined(Q_QDOC) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) namespace Qt { -#else -namespace QTextStreamFunctions { -#endif /*! \relates QTextStream @@ -3064,7 +3057,7 @@ QTextStream &bom(QTextStream &stream) return stream; } -} // namespace QTextStreamFunctions +} // namespace Qt /*! Sets the codec for this stream to \a codec. The codec is used for @@ -3215,6 +3208,45 @@ QLocale QTextStream::locale() const return d->locale; } +#if QT_DEPRECATED_SINCE(5, 15) && !defined(Q_QDOC) +// Deprecated source compatible migration versions: +namespace QTextStreamFunctions { +QTextStream &bin(QTextStream &s) { return Qt::bin(s); } +QTextStream &oct(QTextStream &s) { return Qt::oct(s); } +QTextStream &dec(QTextStream &s) { return Qt::dec(s); } +QTextStream &hex(QTextStream &s) { return Qt::hex(s); } + +QTextStream &showbase(QTextStream &s) { return Qt::showbase(s); } +QTextStream &forcesign(QTextStream &s) { return Qt::forcesign(s); } +QTextStream &forcepoint(QTextStream &s) { return Qt::forcepoint(s); } +QTextStream &noshowbase(QTextStream &s) { return Qt::noshowbase(s); } +QTextStream &noforcesign(QTextStream &s) { return Qt::noforcesign(s); } +QTextStream &noforcepoint(QTextStream &s) { return Qt::noforcepoint(s); } + +QTextStream &uppercasebase(QTextStream &s) { return Qt::uppercasebase(s); } +QTextStream &uppercasedigits(QTextStream &s) { return Qt::uppercasedigits(s); } +QTextStream &lowercasebase(QTextStream &s) { return Qt::lowercasebase(s); } +QTextStream &lowercasedigits(QTextStream &s) { return Qt::lowercasedigits(s); } + +QTextStream &fixed(QTextStream &s) { return Qt::fixed(s); } +QTextStream &scientific(QTextStream &s) { return Qt::scientific(s); } + +QTextStream &left(QTextStream &s) { return Qt::left(s); } +QTextStream &right(QTextStream &s) { return Qt::right(s); } +QTextStream ¢er(QTextStream &s) { return Qt::center(s); } + +QTextStream &endl(QTextStream &s) { return Qt::endl(s); } +QTextStream &flush(QTextStream &s) { return Qt::flush(s); } +QTextStream &reset(QTextStream &s) { return Qt::reset(s); } + +QTextStream &ws(QTextStream &s) { return Qt::ws(s); } + +#if QT_CONFIG(textcodec) +QTextStream &bom(QTextStream &s) { return Qt::bom(s); } +#endif +} // namespace QTextStreamFunctions +#endif + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) // Binary compatible definitions for Qt<5.14 Q_CORE_EXPORT QTextStream &bin(QTextStream &s) { return Qt::bin(s); } diff --git a/src/corelib/serialization/qtextstream.h b/src/corelib/serialization/qtextstream.h index 935ec16536..6f93826d8a 100644 --- a/src/corelib/serialization/qtextstream.h +++ b/src/corelib/serialization/qtextstream.h @@ -233,13 +233,7 @@ inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f) inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m) { m.exec(s); return s; } -#if defined(Q_QDOC) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) namespace Qt { -#else -// This namespace only exists for 'using namespace' declarations. -namespace QTextStreamFunctions { -#endif - Q_CORE_EXPORT QTextStream &bin(QTextStream &s); Q_CORE_EXPORT QTextStream &oct(QTextStream &s); Q_CORE_EXPORT QTextStream &dec(QTextStream &s); @@ -272,12 +266,36 @@ Q_CORE_EXPORT QTextStream &bom(QTextStream &s); Q_CORE_EXPORT QTextStream &ws(QTextStream &s); -} // namespace QTextStreamFunctions +} // namespace Qt -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) -namespace Qt { -using namespace QTextStreamFunctions; -} +#if QT_DEPRECATED_SINCE(5, 15) && !defined(Q_QDOC) +// This namespace only exists for 'using namespace' declarations. +namespace QTextStreamFunctions { +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bin") QTextStream &bin(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::oct") QTextStream &oct(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::dec") QTextStream &dec(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::hex") QTextStream &hex(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::showbase") QTextStream &showbase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcesign") QTextStream &forcesign(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcepoint") QTextStream &forcepoint(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noshowbase") QTextStream &noshowbase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcesign") QTextStream &noforcesign(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcepoint") QTextStream &noforcepoint(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasebase") QTextStream &uppercasebase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasedigits") QTextStream &uppercasedigits(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasebase") QTextStream &lowercasebase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasedigits") QTextStream &lowercasedigits(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::fixed") QTextStream &fixed(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::scientific") QTextStream &scientific(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::left") QTextStream &left(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::right") QTextStream &right(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::center") QTextStream ¢er(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::endl") QTextStream &endl(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::flush") QTextStream &flush(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::reset") QTextStream &reset(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bom") QTextStream &bom(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::ws") QTextStream &ws(QTextStream &s); +} // namespace QTextStreamFunctions QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") @@ -285,7 +303,7 @@ QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") // conflicting definitions compiler errors. using namespace QTextStreamFunctions; QT_WARNING_POP -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) +#endif // QT_DEPRECATED_SINCE(5, 15) && !defined(Q_QDOC) inline QTextStreamManipulator qSetFieldWidth(int width) { diff --git a/src/tools/tracegen/etw.cpp b/src/tools/tracegen/etw.cpp index acd81bd5c1..eac518dbab 100644 --- a/src/tools/tracegen/etw.cpp +++ b/src/tools/tracegen/etw.cpp @@ -90,7 +90,7 @@ static QString createGuid(const QUuid &uuid) QTextStream stream(&guid); - hex(stream); + Qt::hex(stream); stream << "(" << "0x" << uuid.data1 << ", " -- cgit v1.2.3 From a1a3a7cd8abbfcc778c3b57953fd931c87a49278 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 12 Dec 2019 11:36:47 +0100 Subject: Avoid crashing when constructing color-space from invalid enum This is not to be taken as supported and is still undefined behavior, but I prefer we do not crash. Change-Id: Icf4f3398bfd57fcbdc611a5a821a1f2de0838330 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qcolorspace.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp index 9631fdb416..0fb0e9ee33 100644 --- a/src/gui/painting/qcolorspace.cpp +++ b/src/gui/painting/qcolorspace.cpp @@ -422,6 +422,10 @@ QColorSpace::QColorSpace() */ QColorSpace::QColorSpace(NamedColorSpace namedColorSpace) { + if (namedColorSpace < QColorSpace::SRgb || namedColorSpace > QColorSpace::ProPhotoRgb) { + qWarning() << "QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace: " << int(namedColorSpace); + return; + } static QColorSpacePrivate *predefinedColorspacePrivates[QColorSpace::ProPhotoRgb + 1]; if (!predefinedColorspacePrivates[namedColorSpace]) { predefinedColorspacePrivates[namedColorSpace] = new QColorSpacePrivate(namedColorSpace); -- cgit v1.2.3 From 313c2b46fe2830de981c94d07c5ef5ced9cb3257 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 27 Nov 2019 15:00:50 +0100 Subject: Windows QPA: Use UTF-16 literals where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should minimize diffs to Qt 6. Change-Id: Id74c0b4085085984bd51251765420718d16e9fc7 Reviewed-by: André de la Rocha --- .../platforms/windows/qwindowsclipboard.cpp | 4 +- .../platforms/windows/qwindowsdialoghelpers.cpp | 60 +++++++++++----------- .../platforms/windows/qwindowseglcontext.cpp | 2 +- .../platforms/windows/qwindowsintegration.cpp | 32 ++++++------ src/plugins/platforms/windows/qwindowsmenu.cpp | 2 +- src/plugins/platforms/windows/qwindowsmime.cpp | 44 ++++++++-------- .../platforms/windows/qwindowsopengltester.cpp | 4 +- src/plugins/platforms/windows/qwindowsscreen.cpp | 2 +- src/plugins/platforms/windows/qwindowsservices.cpp | 6 +-- .../platforms/windows/qwindowssystemtrayicon.cpp | 2 +- src/plugins/platforms/windows/qwindowstheme.cpp | 14 ++--- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- .../uiautomation/qwindowsuiamainprovider.cpp | 2 +- 13 files changed, 89 insertions(+), 87 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index 4e6d3306e1..ccd4e50a8b 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -82,7 +82,7 @@ static QDebug operator<<(QDebug d, const QMimeData *mimeData) d << "QMimeData("; if (mimeData) { const QStringList formats = mimeData->formats(); - d << "formats=" << formats.join(QLatin1String(", ")); + d << "formats=" << formats.join(u", "); if (mimeData->hasText()) d << ", text=" << mimeData->text(); if (mimeData->hasHtml()) @@ -339,7 +339,7 @@ void QWindowsClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) if (src != S_OK) { QString mimeDataFormats = mimeData ? - mimeData->formats().join(QLatin1String(", ")) : QString(QStringLiteral("NULL")); + mimeData->formats().join(u", ") : QString(QStringLiteral("NULL")); qErrnoWarning("OleSetClipboard: Failed to set mime data (%s) on clipboard: %s", qPrintable(mimeDataFormats), QWindowsContext::comErrorString(src).constData()); diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index cdb4e407d1..b038e19689 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -91,7 +91,7 @@ static inline QString guidToString(const GUID &g) str << '{' << g.Data1 << ", " << g.Data2 << ", " << g.Data3; str.setFieldWidth(2); str.setFieldAlignment(QTextStream::AlignRight); - str.setPadChar(QLatin1Char('0')); + str.setPadChar(u'0'); str << ",{" << g.Data4[0] << ", " << g.Data4[1] << ", " << g.Data4[2] << ", " << g.Data4[3] << ", " << g.Data4[4] << ", " << g.Data4[5] << ", " << g.Data4[6] << ", " << g.Data4[7] << "}};"; @@ -915,7 +915,7 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) return nullptr; } return result; - } else if (url.scheme() == QLatin1String("clsid")) { + } else if (url.scheme() == u"clsid") { // Support for virtual folders via GUID // (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx) // specified as "clsid:" (without '{', '}'). @@ -1040,20 +1040,20 @@ static QList filterSpecs(const QStringList &filters, // Split filter specification as 'Texts (*.txt[;] *.doc)', '*.txt[;] *.doc' // into description and filters specification as '*.txt;*.doc' for (const QString &filterString : filters) { - const int openingParenPos = filterString.lastIndexOf(QLatin1Char('(')); + const int openingParenPos = filterString.lastIndexOf(u'('); const int closingParenPos = openingParenPos != -1 ? - filterString.indexOf(QLatin1Char(')'), openingParenPos + 1) : -1; + filterString.indexOf(u')', openingParenPos + 1) : -1; FilterSpec filterSpec; filterSpec.filter = closingParenPos == -1 ? filterString : filterString.mid(openingParenPos + 1, closingParenPos - openingParenPos - 1).trimmed(); if (filterSpec.filter.isEmpty()) - filterSpec.filter += QLatin1Char('*'); + filterSpec.filter += u'*'; filterSpec.filter.replace(filterSeparatorRE, separator); filterSpec.description = filterString; if (hideFilterDetails && openingParenPos != -1) { // Do not show pattern in description filterSpec.description.truncate(openingParenPos); - while (filterSpec.description.endsWith(QLatin1Char(' '))) + while (filterSpec.description.endsWith(u' ')) filterSpec.description.truncate(filterSpec.description.size() - 1); } *totalStringLength += filterSpec.filter.size() + filterSpec.description.size(); @@ -1084,8 +1084,8 @@ void QWindowsNativeFileDialogBase::setNameFilters(const QStringList &filters) // 'AAA files (a.*) (a.*)' QString description = specs[i].description; const QString &filter = specs[i].filter; - if (!m_hideFiltersDetails && !filter.startsWith(QLatin1String("*."))) { - const int pos = description.lastIndexOf(QLatin1Char('(')); + if (!m_hideFiltersDetails && !filter.startsWith(u"*.")) { + const int pos = description.lastIndexOf(u'('); if (pos > 0) description.truncate(pos); } @@ -1151,8 +1151,8 @@ static bool isHexRange(const QString& s, int start, int end) for (;start < end; ++start) { QChar ch = s.at(start); if (!(ch.isDigit() - || (ch >= QLatin1Char('a') && ch <= QLatin1Char('f')) - || (ch >= QLatin1Char('A') && ch <= QLatin1Char('F')))) + || (ch >= u'a' && ch <= u'f') + || (ch >= u'A' && ch <= u'F'))) return false; } return true; @@ -1161,7 +1161,7 @@ static bool isHexRange(const QString& s, int start, int end) static inline bool isClsid(const QString &s) { // detect "374DE290-123F-4565-9164-39C4925E467B". - const QChar dash(QLatin1Char('-')); + const QChar dash(u'-'); return s.size() == 36 && isHexRange(s, 0, 8) && s.at(8) == dash @@ -1204,7 +1204,7 @@ void QWindowsNativeFileDialogBase::selectNameFilter(const QString &filter) if (index < 0) { qWarning("%s: Invalid parameter '%s' not found in '%s'.", __FUNCTION__, qPrintable(filter), - qPrintable(m_nameFilters.join(QLatin1String(", ")))); + qPrintable(m_nameFilters.join(u", "))); return; } m_fileDialog->SetFileTypeIndex(index + 1); // one-based. @@ -1313,15 +1313,15 @@ public: // Also handles the simple name filter case "*.txt" -> "txt" static inline QString suffixFromFilter(const QString &filter) { - int suffixPos = filter.indexOf(QLatin1String("*.")); + int suffixPos = filter.indexOf(u"*."); if (suffixPos < 0) return QString(); suffixPos += 2; - int endPos = filter.indexOf(QLatin1Char(' '), suffixPos + 1); + int endPos = filter.indexOf(u' ', suffixPos + 1); if (endPos < 0) - endPos = filter.indexOf(QLatin1Char(';'), suffixPos + 1); + endPos = filter.indexOf(u';', suffixPos + 1); if (endPos < 0) - endPos = filter.indexOf(QLatin1Char(')'), suffixPos + 1); + endPos = filter.indexOf(u')', suffixPos + 1); if (endPos < 0) endPos = filter.size(); return filter.mid(suffixPos, endPos - suffixPos); @@ -1406,27 +1406,27 @@ static void cleanupTemporaryItemCopies() static bool validFileNameCharacter(QChar c) { - return c.isLetterOrNumber() || c == QLatin1Char('_') || c == QLatin1Char('-'); + return c.isLetterOrNumber() || c == u'_' || c == u'-'; } QString tempFilePattern(QString name) { - const int lastSlash = qMax(name.lastIndexOf(QLatin1Char('/')), - name.lastIndexOf(QLatin1Char('\\'))); + const int lastSlash = qMax(name.lastIndexOf(u'/'), + name.lastIndexOf(u'\\')); if (lastSlash != -1) name.remove(0, lastSlash + 1); - int lastDot = name.lastIndexOf(QLatin1Char('.')); + int lastDot = name.lastIndexOf(u'.'); if (lastDot < 0) lastDot = name.size(); name.insert(lastDot, QStringLiteral("_XXXXXX")); for (int i = lastDot - 1; i >= 0; --i) { if (!validFileNameCharacter(name.at(i))) - name[i] = QLatin1Char('_'); + name[i] = u'_'; } - name.prepend(QDir::tempPath() + QLatin1Char('/')); + name.prepend(QDir::tempPath() + u'/'); return name; } @@ -1456,7 +1456,7 @@ static QString createTemporaryItemCopy(QWindowsShellItem &qItem, QString *errorM static QUrl itemToDialogUrl(QWindowsShellItem &qItem, QString *errorMessage) { QUrl url = qItem.url(); - if (url.isLocalFile() || url.scheme().startsWith(QLatin1String("http"))) + if (url.isLocalFile() || url.scheme().startsWith(u"http")) return url; const QString path = qItem.path(); if (path.isEmpty() && !qItem.isDir() && qItem.canStream()) { @@ -1859,10 +1859,12 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow // for the target. If it contains any invalid character, the dialog // will not show. ofn->nMaxFile = 65535; - const QString initiallySelectedFile = - QDir::toNativeSeparators(m_data.selectedFile()).remove(QLatin1Char('<')). - remove(QLatin1Char('>')).remove(QLatin1Char('"')).remove(QLatin1Char('|')); - ofn->lpstrFile = qStringToWCharArray(initiallySelectedFile, ofn->nMaxFile); + QString initiallySelectedFile = m_data.selectedFile(); + initiallySelectedFile.remove(u'<'); + initiallySelectedFile.remove(u'>'); + initiallySelectedFile.remove(u'"'); + initiallySelectedFile.remove(u'|'); + ofn->lpstrFile = qStringToWCharArray(QDir::toNativeSeparators(initiallySelectedFile), ofn->nMaxFile); ofn->lpstrInitialDir = qStringToWCharArray(QDir::toNativeSeparators(m_data.directory().toLocalFile())); ofn->lpstrTitle = (wchar_t*)m_title.utf16(); // Determine lpstrDefExt. Note that the current MSDN docs document this @@ -1872,7 +1874,7 @@ void QWindowsXpNativeFileDialog::populateOpenFileName(OPENFILENAME *ofn, HWND ow // the extension of the current filter". if (m_options->acceptMode() == QFileDialogOptions::AcceptSave) { QString defaultSuffix = m_options->defaultSuffix(); - if (defaultSuffix.startsWith(QLatin1Char('.'))) + if (defaultSuffix.startsWith(u'.')) defaultSuffix.remove(0, 1); // QTBUG-33156, also create empty strings to trigger the appending mechanism. ofn->lpstrDefExt = qStringToWCharArray(defaultSuffix); @@ -1905,7 +1907,7 @@ QList QWindowsXpNativeFileDialog::execFileNames(HWND owner, int *selectedF wchar_t *ptr = ofn.lpstrFile + dir.size() + 1; if (*ptr) { result.pop_front(); - const QString path = dir + QLatin1Char('/'); + const QString path = dir + u'/'; while (*ptr) { const QString fileName = QString::fromWCharArray(ptr); result.push_back(QUrl::fromLocalFile(path + fileName)); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index e9f3dc5189..76baa93d98 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -88,7 +88,7 @@ static void *resolveFunc(HMODULE lib, const char *name) while (!proc && argSize <= 64) { nameStr = baseNameStr; if (argSize >= 0) - nameStr += QLatin1Char('@') + QString::number(argSize); + nameStr += u'@' + QString::number(argSize); argSize = argSize < 0 ? 0 : argSize + 4; proc = (void *) ::GetProcAddress(lib, nameStr.toLatin1().constData()); } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 09117f663d..32bd29a842 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -162,7 +162,7 @@ bool parseIntOption(const QString ¶meter,const QLatin1String &option, IntType minimumValue, IntType maximumValue, IntType *target) { const int valueLength = parameter.size() - option.size() - 1; - if (valueLength < 1 || !parameter.startsWith(option) || parameter.at(option.size()) != QLatin1Char('=')) + if (valueLength < 1 || !parameter.startsWith(option) || parameter.at(option.size()) != u'=') return false; bool ok; const QStringRef valueRef = parameter.rightRef(valueLength); @@ -186,38 +186,38 @@ static inline unsigned parseOptions(const QStringList ¶mList, { unsigned options = 0; for (const QString ¶m : paramList) { - if (param.startsWith(QLatin1String("fontengine="))) { - if (param.endsWith(QLatin1String("freetype"))) { + if (param.startsWith(u"fontengine=")) { + if (param.endsWith(u"freetype")) { options |= QWindowsIntegration::FontDatabaseFreeType; - } else if (param.endsWith(QLatin1String("native"))) { + } else if (param.endsWith(u"native")) { options |= QWindowsIntegration::FontDatabaseNative; } - } else if (param.startsWith(QLatin1String("dialogs="))) { - if (param.endsWith(QLatin1String("xp"))) { + } else if (param.startsWith(u"dialogs=")) { + if (param.endsWith(u"xp")) { options |= QWindowsIntegration::XpNativeDialogs; - } else if (param.endsWith(QLatin1String("none"))) { + } else if (param.endsWith(u"none")) { options |= QWindowsIntegration::NoNativeDialogs; } - } else if (param == QLatin1String("altgr")) { + } else if (param == u"altgr") { options |= QWindowsIntegration::DetectAltGrModifier; - } else if (param == QLatin1String("gl=gdi")) { + } else if (param == u"gl=gdi") { options |= QWindowsIntegration::DisableArb; - } else if (param == QLatin1String("nodirectwrite")) { + } else if (param == u"nodirectwrite") { options |= QWindowsIntegration::DontUseDirectWriteFonts; - } else if (param == QLatin1String("nocolorfonts")) { + } else if (param == u"nocolorfonts") { options |= QWindowsIntegration::DontUseColorFonts; - } else if (param == QLatin1String("nomousefromtouch")) { + } else if (param == u"nomousefromtouch") { options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch; } else if (parseIntOption(param, QLatin1String("verbose"), 0, INT_MAX, &QWindowsContext::verbose) || parseIntOption(param, QLatin1String("tabletabsoluterange"), 0, INT_MAX, tabletAbsoluteRange) || parseIntOption(param, QLatin1String("dpiawareness"), QtWindows::ProcessDpiUnaware, QtWindows::ProcessPerMonitorDpiAware, dpiAwareness)) { - } else if (param == QLatin1String("menus=native")) { + } else if (param == u"menus=native") { options |= QWindowsIntegration::AlwaysUseNativeMenus; - } else if (param == QLatin1String("menus=none")) { + } else if (param == u"menus=none") { options |= QWindowsIntegration::NoNativeMenus; - } else if (param == QLatin1String("nowmpointer")) { + } else if (param == u"nowmpointer") { options |= QWindowsIntegration::DontUseWMPointer; - } else if (param == QLatin1String("reverse")) { + } else if (param == u"reverse") { options |= QWindowsIntegration::RtlEnabled; } else { qWarning() << "Unknown option" << param; diff --git a/src/plugins/platforms/windows/qwindowsmenu.cpp b/src/plugins/platforms/windows/qwindowsmenu.cpp index d20edd685e..7c3e87eec1 100644 --- a/src/plugins/platforms/windows/qwindowsmenu.cpp +++ b/src/plugins/platforms/windows/qwindowsmenu.cpp @@ -445,7 +445,7 @@ QString QWindowsMenuItem::nativeText() const QString result = m_text; #if QT_CONFIG(shortcut) if (!m_shortcut.isEmpty()) { - result += QLatin1Char('\t'); + result += u'\t'; result += m_shortcut.toString(QKeySequence::NativeText); } #endif diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 1c6c999f05..fe9e1fe31f 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -635,11 +635,11 @@ bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeDa int ri = 0; bool cr = false; for (int i=0; i < s; ++i) { - if (*u == QLatin1Char('\r')) + if (*u == u'\r') cr = true; else { - if (*u == QLatin1Char('\n') && !cr) - res[ri++] = QLatin1Char('\r'); + if (*u == u'\n' && !cr) + res[ri++] = u'\r'; cr = false; } res[ri++] = *u; @@ -663,7 +663,7 @@ bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeDa bool QWindowsMimeText::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const { - return mimeType.startsWith(QLatin1String("text/plain")) + return mimeType.startsWith(u"text/plain") && (canGetData(CF_UNICODETEXT, pDataObj) || canGetData(CF_TEXT, pDataObj)); } @@ -680,7 +680,7 @@ QString QWindowsMimeText::mimeForFormat(const FORMATETC &formatetc) const QVector QWindowsMimeText::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const { QVector formatics; - if (mimeType.startsWith(QLatin1String("text/plain")) && mimeData->hasText()) { + if (mimeType.startsWith(u"text/plain") && mimeData->hasText()) { formatics += setCf(CF_UNICODETEXT); formatics += setCf(CF_TEXT); } @@ -816,7 +816,7 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat bool QWindowsMimeURI::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const { - return mimeType == QLatin1String("text/uri-list") + return mimeType == u"text/uri-list" && (canGetData(CF_HDROP, pDataObj) || canGetData(CF_INETURL_W, pDataObj) || canGetData(CF_INETURL, pDataObj)); } @@ -831,7 +831,7 @@ QString QWindowsMimeURI::mimeForFormat(const FORMATETC &formatetc) const QVector QWindowsMimeURI::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const { QVector formatics; - if (mimeType == QLatin1String("text/uri-list")) { + if (mimeType == u"text/uri-list") { if (canConvertFromMime(setCf(CF_HDROP), mimeData)) formatics += setCf(CF_HDROP); if (canConvertFromMime(setCf(CF_INETURL_W), mimeData)) @@ -844,7 +844,7 @@ QVector QWindowsMimeURI::formatsForMime(const QString &mimeType, cons QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pDataObj, QVariant::Type preferredType) const { - if (mimeType == QLatin1String("text/uri-list")) { + if (mimeType == u"text/uri-list") { if (canGetData(CF_HDROP, pDataObj)) { QList urls; @@ -916,7 +916,7 @@ QWindowsMimeHtml::QWindowsMimeHtml() QVector QWindowsMimeHtml::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const { QVector formatetcs; - if (mimeType == QLatin1String("text/html") && (!mimeData->html().isEmpty())) + if (mimeType == u"text/html" && (!mimeData->html().isEmpty())) formatetcs += setCf(CF_HTML); return formatetcs; } @@ -930,7 +930,7 @@ QString QWindowsMimeHtml::mimeForFormat(const FORMATETC &formatetc) const bool QWindowsMimeHtml::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const { - return mimeType == QLatin1String("text/html") && canGetData(CF_HTML, pDataObj); + return mimeType == u"text/html" && canGetData(CF_HTML, pDataObj); } @@ -1053,7 +1053,7 @@ QWindowsMimeImage::QWindowsMimeImage() QVector QWindowsMimeImage::formatsForMime(const QString &mimeType, const QMimeData *mimeData) const { QVector formatetcs; - if (mimeData->hasImage() && mimeType == QLatin1String("application/x-qt-image")) { + if (mimeData->hasImage() && mimeType == u"application/x-qt-image") { //add DIBV5 if image has alpha channel. Do not add CF_PNG here as it will confuse MS Office (QTBUG47656). auto image = qvariant_cast(mimeData->imageData()); if (!image.isNull() && image.hasAlphaChannel()) @@ -1075,7 +1075,7 @@ QString QWindowsMimeImage::mimeForFormat(const FORMATETC &formatetc) const bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *pDataObj) const { - return mimeType == QLatin1String("application/x-qt-image") + return mimeType == u"application/x-qt-image" && (canGetData(CF_DIB, pDataObj) || canGetData(CF_PNG, pDataObj)); } @@ -1149,7 +1149,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject * { Q_UNUSED(preferredType); QVariant result; - if (mimeType != QLatin1String("application/x-qt-image")) + if (mimeType != u"application/x-qt-image") return result; //Try to convert from a format which has more data //DIBV5, use only if its is not synthesized @@ -1220,7 +1220,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData { if (canConvertFromMime(formatetc, mimeData)) { QByteArray data; - if (outFormats.value(getCf(formatetc)) == QLatin1String("text/html")) { + if (outFormats.value(getCf(formatetc)) == u"text/html") { // text/html is in wide chars on windows (compatible with mozillia) QString html = mimeData->html(); // same code as in the text converter up above @@ -1232,11 +1232,11 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData int ri = 0; bool cr = false; for (int i=0; i < s; ++i) { - if (*u == QLatin1Char('\r')) + if (*u == u'\r') cr = true; else { - if (*u == QLatin1Char('\n') && !cr) - res[ri++] = QLatin1Char('\r'); + if (*u == u'\n' && !cr) + res[ri++] = u'\r'; cr = false; } res[ri++] = *u; @@ -1285,7 +1285,7 @@ QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDat QByteArray data = getData(inFormats.key(mimeType), pDataObj); if (!data.isEmpty()) { qCDebug(lcQpaMime) << __FUNCTION__; - if (mimeType == QLatin1String("text/html") && preferredType == QVariant::String) { + if (mimeType == u"text/html" && preferredType == QVariant::String) { // text/html is in wide chars on windows (compatible with Mozilla) val = QString::fromWCharArray(reinterpret_cast(data.constData())); } else { @@ -1404,12 +1404,12 @@ static bool isCustomMimeType(const QString &mimeType) static QString customMimeType(const QString &mimeType, int *lindex = nullptr) { int len = sizeof(x_qt_windows_mime) - 1; - int n = mimeType.lastIndexOf(QLatin1Char('\"')) - len; + int n = mimeType.lastIndexOf(u'\"') - len; QString ret = mimeType.mid(len, n); - const int beginPos = mimeType.indexOf(QLatin1String(";index=")); + const int beginPos = mimeType.indexOf(u";index="); if (beginPos > -1) { - const int endPos = mimeType.indexOf(QLatin1Char(';'), beginPos + 1); + const int endPos = mimeType.indexOf(u';', beginPos + 1); const int indexStartPos = beginPos + 7; if (lindex) *lindex = mimeType.midRef(indexStartPos, endPos == -1 ? endPos : endPos - indexStartPos).toInt(); @@ -1480,7 +1480,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const } } if (!ianaType) - format = QLatin1String(x_qt_windows_mime) + clipFormat + QLatin1Char('\"'); + format = QLatin1String(x_qt_windows_mime) + clipFormat + u'"'; else format = clipFormat; } diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index afc1991e2c..72092a4481 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -206,7 +206,7 @@ QString GpuDescription::toString() const str << " Card name : " << description << "\n Driver Name : " << driverName << "\n Driver Version : " << driverVersion.toString() - << "\n Vendor ID : 0x" << qSetPadChar(QLatin1Char('0')) + << "\n Vendor ID : 0x" << qSetPadChar(u'0') << Qt::uppercasedigits << Qt::hex << qSetFieldWidth(4) << vendorId << "\n Device ID : 0x" << qSetFieldWidth(4) << deviceId << "\n SubSys ID : 0x" << qSetFieldWidth(8) << subSysId @@ -285,7 +285,7 @@ static inline QString resolveBugListFile(const QString &fileName) // then resolve via QStandardPaths::ConfigLocation. const QString settingsPath = QLibraryInfo::location(QLibraryInfo::SettingsPath); if (!settingsPath.isEmpty()) { // SettingsPath is empty unless specified in qt.conf. - const QFileInfo fi(settingsPath + QLatin1Char('/') + fileName); + const QFileInfo fi(settingsPath + u'/' + fileName); if (fi.isFile()) return fi.absoluteFilePath(); } diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 4f76a82544..c7a0c2e62e 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -87,7 +87,7 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) data->geometry = QRect(QPoint(info.rcMonitor.left, info.rcMonitor.top), QPoint(info.rcMonitor.right - 1, info.rcMonitor.bottom - 1)); data->availableGeometry = QRect(QPoint(info.rcWork.left, info.rcWork.top), QPoint(info.rcWork.right - 1, info.rcWork.bottom - 1)); data->name = QString::fromWCharArray(info.szDevice); - if (data->name == QLatin1String("WinDisc")) { + if (data->name == u"WinDisc") { data->flags |= QWindowsScreenData::LockScreen; } else { if (const HDC hdc = CreateDC(info.szDevice, nullptr, nullptr, nullptr)) { diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 83b052bb49..6a2708ee26 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -92,7 +92,7 @@ static inline QString mailCommand() // "rundll32.exe .. url.dll,MailToProtocolHandler %l" is returned. Launching it // silently fails or brings up a broken dialog after a long time, so exclude it and // fall back to ShellExecute() which brings up the URL assocation dialog. - if (command.isEmpty() || command.contains(QLatin1String(",MailToProtocolHandler"))) + if (command.isEmpty() || command.contains(u",MailToProtocolHandler")) return QString(); wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(reinterpret_cast(command.utf16()), @@ -108,7 +108,7 @@ static inline bool launchMail(const QUrl &url) return false; } //Make sure the path for the process is in quotes - const QChar doubleQuote = QLatin1Char('"'); + const QChar doubleQuote = u'"'; if (!command.startsWith(doubleQuote)) { const int exeIndex = command.indexOf(QStringLiteral(".exe "), 0, Qt::CaseInsensitive); if (exeIndex != -1) { @@ -140,7 +140,7 @@ static inline bool launchMail(const QUrl &url) bool QWindowsServices::openUrl(const QUrl &url) { const QString scheme = url.scheme(); - if (scheme == QLatin1String("mailto") && launchMail(url)) + if (scheme == u"mailto" && launchMail(url)) return true; return shellExecute(url); } diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp index ab830e1461..66c558df1e 100644 --- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp +++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp @@ -261,7 +261,7 @@ void QWindowsSystemTrayIcon::showMessage(const QString &title, const QString &me // For empty messages, ensures that they show when only title is set QString message = messageIn; if (message.isEmpty() && !title.isEmpty()) - message.append(QLatin1Char(' ')); + message.append(u' '); NOTIFYICONDATA tnd; initNotifyIconData(tnd); diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 32a65109af..010aea2068 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -96,7 +96,7 @@ static inline QTextStream& operator<<(QTextStream &str, const QColor &c) { str.setIntegerBase(16); str.setFieldWidth(2); - str.setPadChar(QLatin1Char('0')); + str.setPadChar(u'0'); str << " rgb: #" << c.red() << c.green() << c.blue(); str.setIntegerBase(10); str.setFieldWidth(0); @@ -731,13 +731,13 @@ static QString dirIconPixmapCacheKey(int iIcon, int iconSize, int imageListSize) { QString key = QLatin1String("qt_dir_") + QString::number(iIcon); if (iconSize == SHGFI_LARGEICON) - key += QLatin1Char('l'); + key += u'l'; switch (imageListSize) { case sHIL_EXTRALARGE: - key += QLatin1Char('e'); + key += u'e'; break; case sHIL_JUMBO: - key += QLatin1Char('j'); + key += u'j'; break; } return key; @@ -815,9 +815,9 @@ QString QWindowsFileIconEngine::cacheKey() const // It is faster to just look at the file extensions; // avoiding slow QFileInfo::isExecutable() (QTBUG-13182) QString suffix = fileInfo().suffix(); - if (!suffix.compare(QLatin1String("exe"), Qt::CaseInsensitive) - || !suffix.compare(QLatin1String("lnk"), Qt::CaseInsensitive) - || !suffix.compare(QLatin1String("ico"), Qt::CaseInsensitive)) { + if (!suffix.compare(u"exe", Qt::CaseInsensitive) + || !suffix.compare(u"lnk", Qt::CaseInsensitive) + || !suffix.compare(u"ico", Qt::CaseInsensitive)) { return QString(); } return QLatin1String("qt_.") diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 5a4f879d0f..a7aad15749 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -253,7 +253,7 @@ QDebug operator<<(QDebug d, const GUID &guid) { QDebugStateSaver saver(d); d.nospace(); - d << '{' << Qt::hex << Qt::uppercasedigits << qSetPadChar(QLatin1Char('0')) + d << '{' << Qt::hex << Qt::uppercasedigits << qSetPadChar(u'0') << qSetFieldWidth(8) << guid.Data1 << qSetFieldWidth(0) << '-' << qSetFieldWidth(4) << guid.Data2 << qSetFieldWidth(0) << '-' << qSetFieldWidth(4) diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index cc293b777c..a0a976545f 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -473,7 +473,7 @@ QString QWindowsUiaMainProvider::automationIdForAccessible(const QAccessibleInte if (name.isEmpty()) return QString(); if (!result.isEmpty()) - result.prepend(QLatin1Char('.')); + result.prepend(u'.'); result.prepend(name); obj = obj->parent(); } -- cgit v1.2.3 From be9398c8d4ab0b7eba74b607d82dc43cd40443b8 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 2 Dec 2019 21:07:44 +0100 Subject: QListModel: fix moveRows() QListModel::moveRows() had an issue when the destination was before the source row. Change-Id: I4ce8b425451f2f53c7eb3b211e9590753dec618a Reviewed-by: Luca Beldi Reviewed-by: David Faure --- src/widgets/itemviews/qlistwidget.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index f71e0f2822..c9379f9a8a 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -301,16 +301,23 @@ bool QListModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int co { if (sourceRow < 0 || sourceRow + count - 1 >= rowCount(sourceParent) - || destinationChild <= 0 + || destinationChild < 0 || destinationChild > rowCount(destinationParent) + || sourceRow == destinationChild || sourceRow == destinationChild - 1 - || count <= 0) { + || count <= 0 + || sourceParent.isValid() + || destinationParent.isValid()) { return false; } if (!beginMoveRows(QModelIndex(), sourceRow, sourceRow + count - 1, QModelIndex(), destinationChild)) return false; - destinationChild--; - const int fromRow = destinationChild < sourceRow ? (sourceRow + count - 1) : sourceRow; + + int fromRow = sourceRow; + if (destinationChild < sourceRow) + fromRow += count - 1; + else + destinationChild--; while (count--) items.move(fromRow, destinationChild); endMoveRows(); -- cgit v1.2.3 From 8d2a6b422f9180ba053f22d7f8583ad559b3e9ca Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 18 Feb 2019 21:46:33 +0100 Subject: QTextDocument: compile with QT_NO_PRINTER The implementation of QTextDocument::print() is not available when QT_NO_PRINTER is defined but the declaration was so when someone is using this function (and QT_NO_PRINTER) a linker error will occur. Fixes: QTBUG-56916 Change-Id: I49aaaa643c4d8587a66fc95733060cea11994872 Reviewed-by: Volker Hilsheimer --- src/gui/text/qtextdocument.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 7d46238257..2459c78768 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -221,7 +221,9 @@ public: bool isModified() const; +#ifndef QT_NO_PRINTER void print(QPagedPaintDevice *printer) const; +#endif enum ResourceType { UnknownResource = 0, -- cgit v1.2.3 From 4e04132264a1259d28dc55e1ad01f848562c4c6d Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 2 Dec 2019 21:04:09 +0100 Subject: QStringListModel: fix moveRows() QStringListMode::moveRows() had an issue when the destination was before the source row. Change-Id: Icf64e5b4cdd6a39faf3ba4ccc3883196b247ccbd Reviewed-by: Luca Beldi Reviewed-by: David Faure --- src/corelib/itemmodels/qstringlistmodel.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index a248cdcd38..9c87ff853a 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -301,24 +301,23 @@ bool QStringListModel::moveRows(const QModelIndex &sourceParent, int sourceRow, { if (sourceRow < 0 || sourceRow + count - 1 >= rowCount(sourceParent) - || destinationChild <= 0 + || destinationChild < 0 || destinationChild > rowCount(destinationParent) + || sourceRow == destinationChild || sourceRow == destinationChild - 1 - || count <= 0) { + || count <= 0 + || sourceParent.isValid() + || destinationParent.isValid()) { return false; } if (!beginMoveRows(QModelIndex(), sourceRow, sourceRow + count - 1, QModelIndex(), destinationChild)) return false; - /* - QList::move assumes that the second argument is the index where the item will end up to - i.e. the valid range for that argument is from 0 to QList::size()-1 - QAbstractItemModel::moveRows when source and destinations have the same parent assumes that - the item will end up being in the row BEFORE the one indicated by destinationChild - i.e. the valid range for that argument is from 1 to QList::size() - For this reason we remove 1 from destinationChild when using it inside QList - */ - destinationChild--; - const int fromRow = destinationChild < sourceRow ? (sourceRow + count - 1) : sourceRow; + + int fromRow = sourceRow; + if (destinationChild < sourceRow) + fromRow += count - 1; + else + destinationChild--; while (count--) lst.move(fromRow, destinationChild); endMoveRows(); -- cgit v1.2.3 From bda2169d965a40b3229421154979526448a1f745 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 25 Nov 2019 20:31:38 +0100 Subject: Doc: remove documented macros which were removed in Qt5 Remove documentation about QMIN, QMAX and QABS - they were removed during Qt4 -> 5 porting. Change-Id: I24e12e4f2bba635ff412e73dd1d0134bbab5247a Reviewed-by: Paul Wicking --- src/corelib/global/qglobal.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b662233d4e..c145c46f78 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4134,36 +4134,6 @@ bool qunsetenv(const char *varName) directive. */ -/*! - \macro QABS(n) - \relates - \obsolete - - Use qAbs(\a n) instead. - - \sa QMIN(), QMAX() -*/ - -/*! - \macro QMIN(x, y) - \relates - \obsolete - - Use qMin(\a x, \a y) instead. - - \sa QMAX(), QABS() -*/ - -/*! - \macro QMAX(x, y) - \relates - \obsolete - - Use qMax(\a x, \a y) instead. - - \sa QMIN(), QABS() -*/ - /*! \macro const char *qPrintable(const QString &str) \relates -- cgit v1.2.3 From abbdd634cd545b8d5ec34a615538f9d4ff2baec3 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 18 Oct 2019 14:15:40 +0200 Subject: Get rid of the getter for QObjectPrivate::threadData The dependent changes have now landed. Change-Id: I502377ab5603d67ada9e5577de1abfccdfa0fa09 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qobject_p.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 1ebf8e7a07..838a9aa8c5 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -374,7 +374,6 @@ public: } public: ExtraData *extraData; // extra data set by the user - QThreadData *getThreadData() const { return threadData.loadAcquire(); } // This atomic requires acquire/release semantics in a few places, // e.g. QObject::moveToThread must synchronize with QCoreApplication::postEvent, // because postEvent is thread-safe. -- cgit v1.2.3 From 05d52685028a46e340d610093c7e7c98479ac18b Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Tue, 17 Dec 2019 13:13:16 +0100 Subject: Fix QPainter::drawLines() with cosmetic pen Even though each line in the array passed to drawLines() should be rendered as an independent line, some state was kept in the cosmetic stroker from one line to the next. This could result in visible rendering errors. Fixes: QTBUG-80834 Change-Id: Ief7bf78eab83ae34459802bff5a57d6beec4a5e5 Reviewed-by: Allan Sandfeld Jensen --- src/gui/painting/qcosmeticstroker.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index 0fb89a75b5..fa34c5598e 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -375,6 +375,7 @@ void QCosmeticStroker::drawLine(const QPointF &p1, const QPointF &p2) patternOffset = state->lastPen.dashOffset()*64; lastPixel.x = INT_MIN; + lastPixel.y = INT_MIN; stroke(this, start.x(), start.y(), end.x(), end.y(), drawCaps ? CapBegin|CapEnd : 0); -- cgit v1.2.3 From 18f22fea7c89da59b040da6361026593c8557a74 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 13 Nov 2019 16:39:52 +0100 Subject: Windows QPA: Allow the native Windows virtual keyboard to be disabled This change provides a way to disable the automatic showing of the native Windows on-screen virtual keyboard when a text editing widget is selected on a system without a physical keyboard, by enabling the new AA_MSWindowsDisableVirtualKeyboard application attribute, allowing applications to use a custom virtual keyboard implementation. Fixes: QTBUG-76088 Change-Id: Id76f9673a2e4081e5325662f3e3b4b102d133b9a Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff --- src/corelib/global/qnamespace.h | 1 + src/corelib/global/qnamespace.qdoc | 6 ++++++ src/plugins/platforms/windows/qwindowsinputcontext.cpp | 3 ++- .../platforms/windows/uiautomation/qwindowsuiamainprovider.cpp | 6 ++++-- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 047ed8e7b3..5b63daec69 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -523,6 +523,7 @@ public: AA_DontUseNativeMenuBar = 6, AA_MacDontSwapCtrlAndMeta = 7, AA_Use96Dpi = 8, + AA_MSWindowsDisableVirtualKeyboard = 9, #if QT_DEPRECATED_SINCE(5, 14) AA_X11InitThreads Q_DECL_ENUMERATOR_DEPRECATED = 10, #endif diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index ef5f345e9c..6149281904 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -293,6 +293,12 @@ This attribute must be set before QGuiApplication is constructed. This value was added in 5.13 + \value AA_MSWindowsDisableVirtualKeyboard When this attribute is set, + Windows' native on-screen virtual keyboard will not be shown + automatically when a text input widget gains focus on a system + without a physical keyboard. + This value was added in 5.15 + The following values are deprecated or obsolete: \value AA_ImmediateWidgetCreation This attribute is no longer fully diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 19d632dc10..f1f5d3a96e 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -285,7 +285,8 @@ void QWindowsInputContext::showInputPanel() // the Surface seems unnecessary there anyway. But leave it hidden for IME. // Only trigger the native OSK if the Qt OSK is not in use. static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE"); - if (imModuleEmpty + bool nativeVKDisabled = QCoreApplication::testAttribute(Qt::AA_MSWindowsDisableVirtualKeyboard); + if ((imModuleEmpty && !nativeVKDisabled) && QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 16299)) { ShowCaret(platformWindow->handle()); diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index a0a976545f..5f564f81c2 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -393,12 +393,14 @@ HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pR // Control type converted from role. auto controlType = roleToControlTypeId(accessible->role()); - // The native OSK should be disbled if the Qt OSK is in use. + // The native OSK should be disbled if the Qt OSK is in use, + // or if disabled via application attribute. static bool imModuleEmpty = qEnvironmentVariableIsEmpty("QT_IM_MODULE"); + bool nativeVKDisabled = QCoreApplication::testAttribute(Qt::AA_MSWindowsDisableVirtualKeyboard); // If we want to disable the native OSK auto-showing // we have to report text fields as non-editable. - if (controlType == UIA_EditControlTypeId && !imModuleEmpty) + if (controlType == UIA_EditControlTypeId && (!imModuleEmpty || nativeVKDisabled)) controlType = UIA_TextControlTypeId; setVariantI4(controlType, pRetVal); -- cgit v1.2.3 From 87cedab94e4ca17e8c77602c0d1d285e3c68cb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 13 Dec 2019 11:47:42 +0100 Subject: Remove ApplicationResourceFlags::ApplicationPaletteExplicitlySet After 8fb881900c7b it's tracked by AA_SetPalette. Since the latter is publicly observable we remove the internal flag instead. Change-Id: Ie69799f1b45d68017cb9eaab2a9986cc9ac9ca38 Reviewed-by: Timur Pocheptsov Reviewed-by: Friedemann Kleint --- src/gui/kernel/qguiapplication.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 54f3996b6e..e534ba377f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -166,7 +166,6 @@ bool QGuiApplicationPrivate::is_fallback_session_management_enabled = true; enum ApplicationResourceFlags { - ApplicationPaletteExplicitlySet = 0x1, ApplicationFontExplicitlySet = 0x2 }; @@ -3297,7 +3296,6 @@ void QGuiApplication::setPalette(const QPalette &pal) else *QGuiApplicationPrivate::app_pal = pal; - applicationResourceFlags |= ApplicationPaletteExplicitlySet; QCoreApplication::setAttribute(Qt::AA_SetPalette); if (qGuiApp) @@ -4100,8 +4098,7 @@ QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) void QGuiApplicationPrivate::notifyThemeChanged() { - if (!(applicationResourceFlags & ApplicationPaletteExplicitlySet) && - !QCoreApplication::testAttribute(Qt::AA_SetPalette)) { + if (!testAttribute(Qt::AA_SetPalette)) { clearPalette(); initPalette(); emit qGuiApp->paletteChanged(*app_pal); -- cgit v1.2.3 From 04f5008f51dee9feec68afcee8cd8314b8e5ac62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 25 Jun 2019 18:42:59 +0200 Subject: Let sendApplicationPaletteChange() decide when it needs to exit early Change-Id: I7a8e6c0b54d2a16a17b292a4102e05f743bcbe29 Reviewed-by: Timur Pocheptsov --- src/gui/kernel/qguiapplication.cpp | 6 ++++-- src/widgets/kernel/qapplication.cpp | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e534ba377f..bab525f809 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -4102,8 +4102,7 @@ void QGuiApplicationPrivate::notifyThemeChanged() clearPalette(); initPalette(); emit qGuiApp->paletteChanged(*app_pal); - if (is_app_running && !is_app_closing) - sendApplicationPaletteChange(); + sendApplicationPaletteChange(); } if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) { const auto locker = qt_scoped_lock(applicationFontMutex); @@ -4118,6 +4117,9 @@ void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, con Q_UNUSED(toAllWidgets) Q_UNUSED(className) + if (!is_app_running || is_app_closing) + return; + QEvent event(QEvent::ApplicationPaletteChange); QGuiApplication::sendEvent(QGuiApplication::instance(), &event); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 5a21a3a15c..6120e0e164 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1390,10 +1390,9 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* hash->insert(className, pal); } - if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { - // Send ApplicationPaletteChange to qApp itself, and to the widgets. + + if (qApp) qApp->d_func()->sendApplicationPaletteChange(all, className); - } if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { QCoreApplication::setAttribute(Qt::AA_SetPalette); @@ -4431,6 +4430,9 @@ void QApplicationPrivate::notifyThemeChanged() void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) { + if (!is_app_running || is_app_closing) + return; + QGuiApplicationPrivate::sendApplicationPaletteChange(); QEvent event(QEvent::ApplicationPaletteChange); -- cgit v1.2.3 From 0a09a6341ddff4397461deb98b8d7a28ca3c9dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 25 Jun 2019 18:36:04 +0200 Subject: Sync implementation of QGuiApplication and QApplication setPalette The two static setPalette methods in QApplication and QGuiApplication should have the same behavior in terms of what signals and events they emit. Change-Id: I54579d490e31f3783e2d4fea689ca799a070ff1d Reviewed-by: Timur Pocheptsov --- src/gui/kernel/qguiapplication.cpp | 7 ++++--- src/widgets/kernel/qapplication.cpp | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index bab525f809..7adba40fbd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3299,7 +3299,7 @@ void QGuiApplication::setPalette(const QPalette &pal) QCoreApplication::setAttribute(Qt::AA_SetPalette); if (qGuiApp) - emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); + qGuiApp->d_func()->sendApplicationPaletteChange(); } void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window) @@ -4101,7 +4101,6 @@ void QGuiApplicationPrivate::notifyThemeChanged() if (!testAttribute(Qt::AA_SetPalette)) { clearPalette(); initPalette(); - emit qGuiApp->paletteChanged(*app_pal); sendApplicationPaletteChange(); } if (!(applicationResourceFlags & ApplicationFontExplicitlySet)) { @@ -4115,7 +4114,9 @@ void QGuiApplicationPrivate::notifyThemeChanged() void QGuiApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const char *className) { Q_UNUSED(toAllWidgets) - Q_UNUSED(className) + + if (!className) + emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); if (!is_app_running || is_app_closing) return; diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 6120e0e164..9b1202c491 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1390,14 +1390,11 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* hash->insert(className, pal); } + if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) + QCoreApplication::setAttribute(Qt::AA_SetPalette); if (qApp) qApp->d_func()->sendApplicationPaletteChange(all, className); - - if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { - QCoreApplication::setAttribute(Qt::AA_SetPalette); - emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); - } } /*! @@ -4433,7 +4430,7 @@ void QApplicationPrivate::sendApplicationPaletteChange(bool toAllWidgets, const if (!is_app_running || is_app_closing) return; - QGuiApplicationPrivate::sendApplicationPaletteChange(); + QGuiApplicationPrivate::sendApplicationPaletteChange(toAllWidgets, className); QEvent event(QEvent::ApplicationPaletteChange); const QWidgetList widgets = QApplication::allWidgets(); -- cgit v1.2.3 From cf3d4cf3c3755faa5474267bf5097e87b9f8152b Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 10 Dec 2019 15:01:11 +0100 Subject: Teach moc to output a Make-style depfile If moc is invoked with the --output-dep-file option, it will generate a "moc_.d" dep file which contains dependency entries that can be consumed by a Makefile / Ninja build system. This is useful for build tools (like CMake) to know when moc should be re-ran. In the future, it might also be useful for ccache (teach ccache not to re-run moc when not necessary). The dependency list contains: the original source file, the passed --include files (like moc_predefs.h), the include files that were discovered while preprocessing the source file, and the plugin metadata json files listed in Q_PLUGIN_METADATA macros. The file paths are encoded using QFile::encodeName, so using the local 8-bit encoding. The paths are also escaped (so ' ' replaced by '\ ', '$' by '$$', etc) according to the Make-style rules as described in clang's dep file generator https://github.com/llvm/llvm-project/blob/release/9.x/clang/lib/Frontend/DependencyFile.cpp#L233 For reference, the equivalent Ninja depfile parser source code can be found at https://github.com/ninja-build/ninja/blob/v1.9.0/src/depfile_parser.in.cc#L37 Additional options that can be passed: --dep-file-path - to change the location where the dep file should be generated. --dep-file-rule-name - to change the rule name (first line) of the dep file (useful when no -o option is specified, so output goes to stdout). Encoding story. Note that moc doesn't handle non-local-8-bit characters properly when processing include directives at the preprocessor step. Specifically the content of the main input file is read as a raw byte array (which can be UTF-8 encoded) and then each include directive is resolved via Preprocessor::resolveInclude(), which calls QString::fromLocal8Bit(). Because moc uses the QtBootstrap library, only a limited set of codecs are available: various UTF 8 / 16 / 32 codecs and QLatin1Codec (ISO-8859-15). This means that on Windows, if the source input file is UTF-8 encoded, and contains include names with UTF-8 characters (like an emoji or any character >= 127 that is not in the QLatin1 codec), moc will fail to resolve and process that include, and thus no dep file entry will be created either. On macOS / QNX / WASM the main locale is UTF-8, so file content and paths will be processed correctly (hardcoded via QT_LOCALE_IS_UTF8 in src/corelib/codecs/qtextcodec_p.h). On Linux it will depend on the current locale / encoding set, and if that encoding is one of the ones supported above. UTF-8 should work fine. [ChangeLog][QtCore][moc] moc can now output a ".d" dep file that can be consumed by other build systems. Task-number: QTBUG-74521 Task-number: QTBUG-76598 Change-Id: I5585631ff1bbbae4e2875cade9cb6c20ed018c0a Reviewed-by: Leander Beernaert Reviewed-by: Joerg Bornemann Reviewed-by: Qt CI Bot --- src/tools/moc/main.cpp | 131 +++++++++++++++++++++++++++++++++++++++++++++++++ src/tools/moc/moc.cpp | 1 + src/tools/moc/moc.h | 1 + 3 files changed, 133 insertions(+) (limited to 'src') diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 4aa040a9bb..b8c2d7f594 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -175,6 +175,49 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) return allArguments; } +// Escape characters in given path. Dependency paths are Make-style, not NMake/Jom style. +// The paths can also be consumed by Ninja. +// "$" replaced by "$$" +// "#" replaced by "\#" +// " " replaced by "\ " +// "\#" replaced by "\\#" +// "\ " replaced by "\\\ " +// +// The escape rules are according to what clang / llvm escapes when generating a Make-style +// dependency file. +// Is a template function, because input param can be either a QString or a QByteArray. +template struct CharType; +template <> struct CharType { using type = QLatin1Char; }; +template <> struct CharType { using type = char; }; +template +StringType escapeDependencyPath(const StringType &path) +{ + using CT = typename CharType::type; + StringType escapedPath; + int size = path.size(); + escapedPath.reserve(size); + for (int i = 0; i < size; ++i) { + if (path[i] == CT('$')) { + escapedPath.append(CT('$')); + } else if (path[i] == CT('#')) { + escapedPath.append(CT('\\')); + } else if (path[i] == CT(' ')) { + escapedPath.append(CT('\\')); + int backwards_it = i - 1; + while (backwards_it > 0 && path[backwards_it] == CT('\\')) { + escapedPath.append(CT('\\')); + --backwards_it; + } + } + escapedPath.append(path[i]); + } + return escapedPath; +} + +QByteArray escapeAndEncodeDependencyPath(const QString &path) +{ + return QFile::encodeName(escapeDependencyPath(path)); +} int runMoc(int argc, char **argv) { @@ -308,6 +351,22 @@ int runMoc(int argc, char **argv) collectOption.setDescription(QStringLiteral("Instead of processing C++ code, collect previously generated JSON output into a single file.")); parser.addOption(collectOption); + QCommandLineOption depFileOption(QStringLiteral("output-dep-file")); + depFileOption.setDescription( + QStringLiteral("Output a Make-style dep file for build system consumption.")); + parser.addOption(depFileOption); + + QCommandLineOption depFilePathOption(QStringLiteral("dep-file-path")); + depFilePathOption.setDescription(QStringLiteral("Path where to write the dep file.")); + depFilePathOption.setValueName(QStringLiteral("file")); + parser.addOption(depFilePathOption); + + QCommandLineOption depFileRuleNameOption(QStringLiteral("dep-file-rule-name")); + depFileRuleNameOption.setDescription( + QStringLiteral("The rule name (first line) of the dep file.")); + depFileRuleNameOption.setValueName(QStringLiteral("rule name")); + parser.addOption(depFileRuleNameOption); + parser.addPositionalArgument(QStringLiteral("[header-file]"), QStringLiteral("Header file to read from, otherwise stdin.")); parser.addPositionalArgument(QStringLiteral("[@option-file]"), @@ -476,6 +535,7 @@ int runMoc(int argc, char **argv) // 1. preprocess const auto includeFiles = parser.values(includeOption); + QStringList validIncludesFiles; for (const QString &includeName : includeFiles) { QByteArray rawName = pp.resolveInclude(QFile::encodeName(includeName), moc.filename); if (rawName.isEmpty()) { @@ -488,6 +548,7 @@ int runMoc(int argc, char **argv) moc.symbols += Symbol(0, MOC_INCLUDE_BEGIN, rawName); moc.symbols += pp.preprocessed(rawName, &f); moc.symbols += Symbol(0, MOC_INCLUDE_END, rawName); + validIncludesFiles.append(includeName); } else { fprintf(stderr, "Warning: Cannot open %s included by moc file %s: %s\n", rawName.constData(), @@ -507,6 +568,7 @@ int runMoc(int argc, char **argv) QScopedPointer jsonOutput; + bool outputToFile = true; if (output.size()) { // output file specified #if defined(_MSC_VER) if (_wfopen_s(&out, reinterpret_cast(output.utf16()), L"w") != 0) @@ -535,6 +597,7 @@ int runMoc(int argc, char **argv) } } else { // use stdout out = stdout; + outputToFile = false; } if (pp.preprocessOnly) { @@ -549,6 +612,74 @@ int runMoc(int argc, char **argv) if (output.size()) fclose(out); + if (parser.isSet(depFileOption)) { + // 4. write a Make-style dependency file (can also be consumed by Ninja). + QString depOutputFileName; + QString depRuleName = output; + + if (parser.isSet(depFileRuleNameOption)) + depRuleName = parser.value(depFileRuleNameOption); + + if (parser.isSet(depFilePathOption)) { + depOutputFileName = parser.value(depFilePathOption); + } else if (outputToFile) { + depOutputFileName = output + QLatin1String(".d"); + } else { + fprintf(stderr, "moc: Writing to stdout, but no depfile path specified.\n"); + } + + QScopedPointer depFileHandle; + FILE *depFileHandleRaw; +#if defined(_MSC_VER) + if (_wfopen_s(&depFileHandleRaw, + reinterpret_cast(depOutputFileName.utf16()), L"w") != 0) +#else + depFileHandleRaw = fopen(QFile::encodeName(depOutputFileName).constData(), "w"); + if (!depFileHandleRaw) +#endif + fprintf(stderr, "moc: Cannot create dep output file '%s'. %s\n", + QFile::encodeName(depOutputFileName).constData(), + strerror(errno)); + depFileHandle.reset(depFileHandleRaw); + + if (!depFileHandle.isNull()) { + // First line is the path to the generated file. + fprintf(depFileHandle.data(), "%s: ", + escapeAndEncodeDependencyPath(depRuleName).constData()); + + QByteArrayList dependencies; + + // If there's an input file, it's the first dependency. + if (!filename.isEmpty()) { + dependencies.append(escapeAndEncodeDependencyPath(filename).constData()); + } + + // Additional passed-in includes are dependencies (like moc_predefs.h). + for (const QString &includeName : validIncludesFiles) { + dependencies.append(escapeAndEncodeDependencyPath(includeName).constData()); + } + + // Plugin metadata json files discovered via Q_PLUGIN_METADATA macros are also + // dependencies. + for (const QString &pluginMetadataFile : moc.parsedPluginMetadataFiles) { + dependencies.append(escapeAndEncodeDependencyPath(pluginMetadataFile).constData()); + } + + // All pre-processed includes are dependnecies. + // Sort the entries for easier human consumption. + auto includeList = pp.preprocessedIncludes.values(); + std::sort(includeList.begin(), includeList.end()); + + for (QByteArray &includeName : includeList) { + dependencies.append(escapeDependencyPath(includeName)); + } + + // Join dependencies, output them, and output a final new line. + const auto dependenciesJoined = dependencies.join(QByteArrayLiteral(" \\\n ")); + fprintf(depFileHandle.data(), "%s\n", dependenciesJoined.constData()); + } + } + return 0; } diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 58c9f88328..d7a1af0a18 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1382,6 +1382,7 @@ void Moc::parsePluginData(ClassDef *def) error(msg.constData()); return; } + parsedPluginMetadataFiles.append(fi.canonicalFilePath()); metaData = file.readAll(); } } diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 687ea2552f..5d1ae0ad6d 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -223,6 +223,7 @@ public: QHash knownQObjectClasses; QHash knownGadgets; QMap metaArgs; + QVector parsedPluginMetadataFiles; void parse(); void generate(FILE *out, FILE *jsonOutput); -- cgit v1.2.3 From b2e3a5502afc0398cb8a732c366253e72a64b744 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 6 Dec 2019 13:30:40 +0100 Subject: Parse Xft.dpi with fraction Some versions of GNOME 3 would set Xft.dpi with fraction though that is technically not valid. Change-Id: Ib1027283cc78fd5d9869cd337864a92e28cd7e88 Fixes: QTBUG-64738 Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbscreen.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 7c60ca06f9..44d0bb3f55 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -320,12 +320,22 @@ bool QXcbVirtualDesktop::xResource(const QByteArray &identifier, static bool parseXftInt(const QByteArray& stringValue, int *value) { - Q_ASSERT(value != 0); + Q_ASSERT(value); bool ok; *value = stringValue.toInt(&ok); return ok; } +static bool parseXftDpi(const QByteArray& stringValue, int *value) +{ + Q_ASSERT(value); + bool ok = parseXftInt(stringValue, value); + // Support GNOME 3 bug that wrote DPI with fraction: + if (!ok) + *value = qRound(stringValue.toDouble(&ok)); + return ok; +} + static QFontEngine::HintStyle parseXftHintStyle(const QByteArray& stringValue) { if (stringValue == "hintfull") @@ -391,7 +401,7 @@ void QXcbVirtualDesktop::readXResources() int value; QByteArray stringValue; if (xResource(r, "Xft.dpi:\t", stringValue)) { - if (parseXftInt(stringValue, &value)) + if (parseXftDpi(stringValue, &value)) m_forcedDpi = value; } else if (xResource(r, "Xft.hintstyle:\t", stringValue)) { m_hintStyle = parseXftHintStyle(stringValue); -- cgit v1.2.3 From 48704c3f5c18c126fc777e5669ccca0d37f9663e Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 18 Dec 2019 10:22:59 +0100 Subject: Doc: Add since Qt 5.8 info for QResource::lastModified() Fixes: QTBUG-80856 Change-Id: I2f2b562ad2b262c6dfa236a43589129186589ed7 Reviewed-by: Paul Wicking --- src/corelib/io/qresource.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 5cbe49e2f7..a494daa29f 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -629,6 +629,8 @@ const uchar *QResource::data() const } /*! + \since 5.8 + Returns the date and time when the file was last modified before packaging into a resource. */ -- cgit v1.2.3 From f2d752c59f5a1d2e815394d718350d0fcaf43ef6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 6 Dec 2019 14:16:31 +0100 Subject: QWindowSystemInterface: use QBasicMutex and qt_scoped_lock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no reason to use a class-static mutex object here. Use a namespace-static QBasicMutex, port to qt_scoped_lock. Change-Id: Ia9bd3c2fadbf1da25ef79bb393c899b678cbc182 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 10 ++++++---- src/gui/kernel/qwindowsysteminterface_p.h | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index c9a70897d6..31765cf54c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -46,7 +46,9 @@ #include #include #include "qhighdpiscaling_p.h" + #include +#include #if QT_CONFIG(draganddrop) #include @@ -623,7 +625,7 @@ bool QWindowSystemInterface::isTouchDeviceRegistered(const QTouchDevice *device) static int g_nextPointId = 1; // map from device-independent point id (arbitrary) to "Qt point" ids -QMutex QWindowSystemInterfacePrivate::pointIdMapMutex; +static QBasicMutex pointIdMapMutex; typedef QMap PointIdMap; Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) @@ -641,7 +643,7 @@ Q_GLOBAL_STATIC(PointIdMap, g_pointIdMap) */ static int acquireCombinedPointId(quint8 deviceId, int pointId) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); quint64 combinedId64 = (quint64(deviceId) << 32) + pointId; auto it = g_pointIdMap->constFind(combinedId64); @@ -702,7 +704,7 @@ QList } if (states == Qt::TouchPointReleased) { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); // All points on deviceId have been released. // Remove all points associated with that device from g_pointIdMap. @@ -723,7 +725,7 @@ QList void QWindowSystemInterfacePrivate::clearPointIdMap() { - QMutexLocker locker(&QWindowSystemInterfacePrivate::pointIdMapMutex); + const auto locker = qt_scoped_lock(pointIdMapMutex); g_pointIdMap->clear(); g_nextPointId = 1; } diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 6e4bce607e..dd6f29b41f 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -529,7 +529,6 @@ public: static QWaitCondition eventsFlushed; static QMutex flushEventMutex; - static QMutex pointIdMapMutex; static QAtomicInt eventAccepted; static QList -- cgit v1.2.3 From 2614347ab8aa0ec0b1ea8f383ae795cfdb6ae2ac Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 17 Dec 2019 19:58:58 +0100 Subject: Fix QSpinbox default width After aa8d3f90a440575deef914916299b792105d7209 the default width of the spinbox buttons is calculated from the spinbox width. This is wrong because the initial width (e.g. when the spinbox is not yet shown) is 640 pixels which results in a too long width. Therefore fall back to the old hard-coded value version but instead using 20 pixels, use 16 to be in sync with the stylesheet style value and honor the dpi of the screen by using QStyleHelper::dpiScaled(). Fixes: QTBUG-79806 Fixes: QTBUG-80814 Change-Id: I45786684575273f940e498df3b7639e626f00a7e Reviewed-by: Friedemann Kleint Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qcommonstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 03081658bb..49b92a69f8 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5027,8 +5027,9 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_SpinBox: if (const QStyleOptionSpinBox *vopt = qstyleoption_cast(opt)) { // Add button + frame widths + const qreal dpi = QStyleHelper::dpi(opt); const bool hasButtons = (vopt->buttonSymbols != QAbstractSpinBox::NoButtons); - const int buttonWidth = hasButtons ? proxy()->subControlRect(CC_SpinBox, vopt, SC_SpinBoxUp, widget).width() : 0; + const int buttonWidth = hasButtons ? qRound(QStyleHelper::dpiScaled(16, dpi)) : 0; const int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget) : 0; sz += QSize(buttonWidth + 2*fw, 2*fw); } -- cgit v1.2.3 From 322e5b7f5e35db73f7d7730a6fff558e153ad356 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 18 Dec 2019 16:05:52 +0100 Subject: QtWidget docs: small fixes Apply some minor fixes to the widget docs - use nullptr - use c++11 initializer list - properly delete widget when cleaning the layout (QTBUG-29471) - rework CardLayout example to make it work with Qt5 Fixes: QTBUG-29471 Change-Id: Ie2ee9f75eb8faf97d2bbd2c25e7013d4f30d8dd0 Reviewed-by: Friedemann Kleint Reviewed-by: Paul Wicking --- src/widgets/doc/snippets/code/doc_src_layout.cpp | 53 +++++++++++----------- .../snippets/code/src_gui_dialogs_qfiledialog.cpp | 17 ++++--- .../code/src_gui_itemviews_qtreewidget.cpp | 2 +- .../snippets/code/src_gui_kernel_qapplication.cpp | 7 +-- .../doc/snippets/code/src_gui_kernel_qlayout.cpp | 5 +- .../snippets/code/src_gui_kernel_qlayoutitem.cpp | 3 +- .../doc/snippets/code/src_gui_qproxystyle.cpp | 8 ++-- .../doc/snippets/code/src_gui_widgets_qmenubar.cpp | 2 +- .../code/src_gui_widgets_qsplashscreen.cpp | 4 +- .../doc/src/widgets-and-layouts/layout.qdoc | 2 +- 10 files changed, 52 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/widgets/doc/snippets/code/doc_src_layout.cpp b/src/widgets/doc/snippets/code/doc_src_layout.cpp index 5e9a740244..7bbd781bb2 100644 --- a/src/widgets/doc/snippets/code/doc_src_layout.cpp +++ b/src/widgets/doc/snippets/code/doc_src_layout.cpp @@ -53,14 +53,15 @@ #define CARD_H #include -#include +#include class CardLayout : public QLayout { public: - CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {} - CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {} - CardLayout(int dist): QLayout(dist) {} + CardLayout(int spacing): QLayout() + { setSpacing(spacing); } + CardLayout(int spacing, QWidget *parent): QLayout(parent) + { setSpacing(spacing); } ~CardLayout(); void addItem(QLayoutItem *item) override; @@ -72,7 +73,7 @@ public: void setGeometry(const QRect &rect) override; private: - QList list; + QVector m_items; }; #endif //! [0] @@ -85,23 +86,23 @@ private: //! [2] int CardLayout::count() const { - // QList::size() returns the number of QLayoutItems in the list - return list.size(); + // QVector::size() returns the number of QLayoutItems in m_items + return m_items.size(); } //! [2] //! [3] QLayoutItem *CardLayout::itemAt(int idx) const { - // QList::value() performs index checking, and returns 0 if we are + // QVector::value() performs index checking, and returns nullptr if we are // outside the valid range - return list.value(idx); + return m_items.value(idx); } QLayoutItem *CardLayout::takeAt(int idx) { - // QList::take does not do index checking - return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0; + // QVector::take does not do index checking + return idx >= 0 && idx < m_items.size() ? m_items.takeAt(idx) : 0; } //! [3] @@ -109,7 +110,7 @@ QLayoutItem *CardLayout::takeAt(int idx) //! [4] void CardLayout::addItem(QLayoutItem *item) { - list.append(item); + m_items.append(item); } //! [4] @@ -129,14 +130,14 @@ void CardLayout::setGeometry(const QRect &r) { QLayout::setGeometry(r); - if (list.size() == 0) + if (m_items.size() == 0) return; - int w = r.width() - (list.count() - 1) * spacing(); - int h = r.height() - (list.count() - 1) * spacing(); + int w = r.width() - (m_items.count() - 1) * spacing(); + int h = r.height() - (m_items.count() - 1) * spacing(); int i = 0; - while (i < list.size()) { - QLayoutItem *o = list.at(i); + while (i < m_items.size()) { + QLayoutItem *o = m_items.at(i); QRect geom(r.x() + i * spacing(), r.y() + i * spacing(), w, h); o->setGeometry(geom); ++i; @@ -148,29 +149,29 @@ void CardLayout::setGeometry(const QRect &r) //! [7] QSize CardLayout::sizeHint() const { - QSize s(0,0); - int n = list.count(); + QSize s(0, 0); + int n = m_items.count(); if (n > 0) - s = QSize(100,70); //start with a nice default size + s = QSize(100, 70); //start with a nice default size int i = 0; while (i < n) { - QLayoutItem *o = list.at(i); + QLayoutItem *o = m_items.at(i); s = s.expandedTo(o->sizeHint()); ++i; } - return s + n*QSize(spacing(), spacing()); + return s + n * QSize(spacing(), spacing()); } QSize CardLayout::minimumSize() const { - QSize s(0,0); - int n = list.count(); + QSize s(0, 0); + int n = m_items.count(); int i = 0; while (i < n) { - QLayoutItem *o = list.at(i); + QLayoutItem *o = m_items.at(i); s = s.expandedTo(o->minimumSize()); ++i; } - return s + n*QSize(spacing(), spacing()); + return s + n * QSize(spacing(), spacing()); } //! [7] diff --git a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp index 4b4fb869f9..ed6043564b 100644 --- a/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp +++ b/src/widgets/doc/snippets/code/src_gui_dialogs_qfiledialog.cpp @@ -89,11 +89,10 @@ dialog.setNameFilter("*.cpp *.cc *.C *.cxx *.c++"); //! [7] -QStringList filters; -filters << "Image files (*.png *.xpm *.jpg)" - << "Text files (*.txt)" - << "Any files (*)"; - +const QStringList filters({"Image files (*.png *.xpm *.jpg)", + "Text files (*.txt)", + "Any files (*)" + }); QFileDialog dialog(this); dialog.setNameFilters(filters); dialog.exec(); @@ -131,10 +130,10 @@ QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), //! [12] //! [13] -QStringList mimeTypeFilters; -mimeTypeFilters << "image/jpeg" // will show "JPEG image (*.jpeg *.jpg *.jpe) - << "image/png" // will show "PNG image (*.png)" - << "application/octet-stream"; // will show "All files (*)" +QStringList mimeTypeFilters({"image/jpeg", // will show "JPEG image (*.jpeg *.jpg *.jpe) + "image/png", // will show "PNG image (*.png)" + "application/octet-stream" // will show "All files (*)" + }); QFileDialog dialog(this); dialog.setMimeTypeFilters(mimeTypeFilters); diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp index 792cc48ca7..f1e3b6ea45 100644 --- a/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp +++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qtreewidget.cpp @@ -53,6 +53,6 @@ QTreeWidget *treeWidget = new QTreeWidget(); treeWidget->setColumnCount(1); QList items; for (int i = 0; i < 10; ++i) - items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.append(new QTreeWidgetItem(static_cast(nullptr), QStringList(QString("item: %1").arg(i)))); treeWidget->insertTopLevelItems(0, items); //! [0] diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp index 0a70c1d32a..5e1f0883e7 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -51,9 +51,10 @@ //! [0] QCoreApplication* createApplication(int &argc, char *argv[]) { - for (int i = 1; i < argc; ++i) + for (int i = 1; i < argc; ++i) { if (!qstrcmp(argv[i], "-no-gui")) return new QCoreApplication(argc, argv); + } return new QApplication(argc, argv); } @@ -187,14 +188,14 @@ for (const QString &command : commands) //! [12] -QWidget *widget = qApp->widgetAt(x, y); +QWidget *widget = QApplication::widgetAt(x, y); if (widget) widget = widget->window(); //! [12] //! [13] -QWidget *widget = qApp->widgetAt(point); +QWidget *widget = QApplication::widgetAt(point); if (widget) widget = widget->window(); //! [13] diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp index 1a716029a9..c55834ebfb 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qlayout.cpp @@ -70,8 +70,9 @@ void MyWidget::paintEvent(QPaintEvent *) //! [1] QLayoutItem *child; -while ((child = layout->takeAt(0)) != 0) { +while ((child = layout->takeAt(0)) != nullptr) { ... - delete child; + delete child->widget(); // delete the widget + delete child; // delete the layout item } //! [1] diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp index d9f70b91ed..dd0f860c01 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qlayoutitem.cpp @@ -52,8 +52,7 @@ int MyLayout::heightForWidth(int w) const { if (cache_dirty || cached_width != w) { - // not all C++ compilers support "mutable" - MyLayout *that = (MyLayout*)this; + MyLayout *that = const_cast(this); int h = calculateHeightForWidth(w); that->cached_hfw = h; return h; diff --git a/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp b/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp index 3169d1c193..98dc0ff55b 100644 --- a/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp +++ b/src/widgets/doc/snippets/code/src_gui_qproxystyle.cpp @@ -53,8 +53,8 @@ class MyProxyStyle : public QProxyStyle { public: - int styleHint(StyleHint hint, const QStyleOption *option = 0, - const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const override + int styleHint(StyleHint hint, const QStyleOption *option = nullptr, + const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override { if (hint == QStyle::SH_UnderlineShortcut) return 1; @@ -72,8 +72,8 @@ public: class MyProxyStyle : public QProxyStyle { public: - int styleHint(StyleHint hint, const QStyleOption *option = 0, - const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const override + int styleHint(StyleHint hint, const QStyleOption *option = nullptr, + const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override { if (hint == QStyle::SH_UnderlineShortcut) return 0; diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp index b82c67b379..b52b0064ad 100644 --- a/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp +++ b/src/widgets/doc/snippets/code/src_gui_widgets_qmenubar.cpp @@ -54,5 +54,5 @@ menubar->addMenu(fileMenu); //! [1] -QMenuBar *menuBar = new QMenuBar(0); +QMenuBar *menuBar = new QMenuBar(nullptr); //! [1] diff --git a/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp b/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp index b9c0b1a38b..91aa8a9c4e 100644 --- a/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp +++ b/src/widgets/doc/snippets/code/src_gui_widgets_qsplashscreen.cpp @@ -56,10 +56,10 @@ splash->show(); ... // Loading some items splash->showMessage("Loaded modules"); -qApp->processEvents(); +QCoreApplication::processEvents(); ... // Establishing connections splash->showMessage("Established connections"); -qApp->processEvents(); +QCoreApplication::processEvents(); //! [0] diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index 65569a9cd2..e42e6d42ec 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -300,7 +300,7 @@ \list \li A data structure to store the items handled by the layout. Each item is a \l{QLayoutItem}{QLayoutItem}. We will use a - QList in this example. + QVector in this example. \li \l{QLayout::}{addItem()}, how to add items to the layout. \li \l{QLayout::}{setGeometry()}, how to perform the layout. \li \l{QLayout::}{sizeHint()}, the preferred size of the layout. -- cgit v1.2.3 From caa82e1fc24907af0a81e31cf9b77ae8e82e44cc Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Wed, 18 Dec 2019 15:27:06 +0100 Subject: Doc: Add since version for QCursor::swap and QOperatingSystemVersion::currentType. Fixes: QTBUG-80854 Fixes: QTBUG-80891 Change-Id: Ia256fa0d3ad4665f44b933f5a4a8d4ee87e9fc13 Reviewed-by: Timur Pocheptsov Reviewed-by: Leena Miettinen --- src/corelib/global/qoperatingsystemversion.cpp | 2 ++ src/gui/kernel/qcursor.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qoperatingsystemversion.cpp b/src/corelib/global/qoperatingsystemversion.cpp index 33793ca168..261f5c8795 100644 --- a/src/corelib/global/qoperatingsystemversion.cpp +++ b/src/corelib/global/qoperatingsystemversion.cpp @@ -299,6 +299,8 @@ int QOperatingSystemVersion::compare(const QOperatingSystemVersion &v1, Returns the current OS type without constructing a QOperatingSystemVersion instance. + \since 5.10 + \sa current() */ diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 1ba8760a9d..fd912362bf 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -175,6 +175,8 @@ QT_BEGIN_NAMESPACE \fn void QCursor::swap(QCursor &other) Swaps this cursor with the \a other cursor. + + \since 5.7 */ /*! -- cgit v1.2.3 From a132e0254005b2954b11705b32650c9018049187 Mon Sep 17 00:00:00 2001 From: Peter Varga Date: Mon, 18 Nov 2019 15:00:58 +0100 Subject: Fix QAccessibleWidget::focusChild() to return focused descendant This method should not ignore accessibility objects without corresponding widget. The widget may have parts with their own QAccessibilityInterface and these can be also focused. VoiceOver ignores them if they are not returned by focusChild(). QAccessibleTabBar::focusChild() has been implemented to demonstrate the concept and make tab titles of QTabBar readable by VoiceOver. Task-number: QTBUG-78284 Change-Id: Id7c62d86154bbd5d47d6bbee8cb7d05268c2e151 Reviewed-by: Allan Sandfeld Jensen --- src/widgets/accessible/complexwidgets.cpp | 15 ++++++++++++++- src/widgets/accessible/complexwidgets_p.h | 1 + src/widgets/accessible/qaccessiblewidget.cpp | 12 ++++++++---- 3 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 63c6fbb9bb..5c993262bf 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -108,7 +108,10 @@ public: s.invalid = true; return s; } - return parent()->state(); + + QAccessible::State s = parent()->state(); + s.focused = (m_index == m_parent->currentIndex()); + return s; } QRect rect() const override { if (!isValid()) @@ -216,6 +219,16 @@ QTabBar *QAccessibleTabBar::tabBar() const return qobject_cast(object()); } +QAccessibleInterface* QAccessibleTabBar::focusChild() const +{ + for (int i = 0; i < childCount(); ++i) { + if (child(i)->state().focused) + return child(i); + } + + return nullptr; +} + QAccessibleInterface* QAccessibleTabBar::child(int index) const { if (QAccessible::Id id = m_childInterfaces.value(index)) diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h index e7a32c7264..335e257476 100644 --- a/src/widgets/accessible/complexwidgets_p.h +++ b/src/widgets/accessible/complexwidgets_p.h @@ -112,6 +112,7 @@ public: explicit QAccessibleTabBar(QWidget *w); ~QAccessibleTabBar(); + QAccessibleInterface *focusChild() const override; int childCount() const override; QString text(QAccessible::Text t) const override; diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 27e6b09dc7..3ab66c4ce4 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -374,11 +374,15 @@ QAccessibleInterface *QAccessibleWidget::focusChild() const QWidget *fw = widget()->focusWidget(); if (!fw) - return 0; + return nullptr; - if (isAncestor(widget(), fw) || fw == widget()) - return QAccessible::queryAccessibleInterface(fw); - return 0; + if (isAncestor(widget(), fw)) { + QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(fw); + if (!iface || iface == this || !iface->focusChild()) + return iface; + return iface->focusChild(); + } + return nullptr; } /*! \reimp */ -- cgit v1.2.3 From 512b87bc28fc70058e240cf720fdfc9c9da98afb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 18 Dec 2019 09:32:31 +0100 Subject: Don't have a "see also qrand" from qrand I guess what we wanted there was qsrand Change-Id: I8e18e76ae65abf9de231d51faa61cc9142ea2b98 Reviewed-by: Thiago Macieira --- src/corelib/global/qrandom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 3cbd40b772..10672c1f92 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -1295,7 +1295,7 @@ void qsrand(uint seed) \note This function is deprecated. In new applications, use QRandomGenerator instead. - \sa qrand(), QRandomGenerator + \sa qsrand(), QRandomGenerator */ int qrand() { -- cgit v1.2.3 From e2f4c5f4a115d1b7431d7d5781e9e1886b9b2450 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Dec 2019 10:24:55 +0100 Subject: double-conversion.cc: Fix developer build with clang-cl clang-cl errors out with an unknown #pragma on the scope turning off optimization for MSVC2012. Remove it since MSVC2012 is no longer supported. Change-Id: I46610885e10158bc5b3666b7698dc1162dbac8a7 Reviewed-by: Ulf Hermann --- src/3rdparty/double-conversion/double-conversion.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src') diff --git a/src/3rdparty/double-conversion/double-conversion.cc b/src/3rdparty/double-conversion/double-conversion.cc index 8c52755cfb..148193b72a 100644 --- a/src/3rdparty/double-conversion/double-conversion.cc +++ b/src/3rdparty/double-conversion/double-conversion.cc @@ -535,22 +535,10 @@ static double SignedZero(bool sign) { // Returns true if 'c' is a decimal digit that is valid for the given radix. -// -// The function is small and could be inlined, but VS2012 emitted a warning -// because it constant-propagated the radix and concluded that the last -// condition was always true. By moving it into a separate function the -// compiler wouldn't warn anymore. -#ifdef _MSC_VER -#pragma optimize("",off) -static bool IsDecimalDigitForRadix(int c, int radix) { - return '0' <= c && c <= '9' && (c - '0') < radix; -} -#pragma optimize("",on) -#else static bool inline IsDecimalDigitForRadix(int c, int radix) { return '0' <= c && c <= '9' && (c - '0') < radix; } -#endif + // Returns true if 'c' is a character digit that is valid for the given radix. // The 'a_character' should be 'a' or 'A'. // -- cgit v1.2.3 From 09f19e48ac2a34ea2df9d19267599e05d64d45c6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Dec 2019 13:16:20 +0100 Subject: Fix unneeded use of QImage invertPixels and createAlphaMask The result of createAlphaMask was mostly overwritten and then inverted, we can write the right values directly instead. Change-Id: I3cdddcc74218a4058bddd20178733688607c8a01 Reviewed-by: Eirik Aavitsland --- src/plugins/imageformats/ico/qicohandler.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index c8e31dceac..6515748bf5 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -615,13 +615,7 @@ bool ICOReader::write(QIODevice *device, const QVector &images) } QImage maskImage(image.width(), image.height(), QImage::Format_Mono); image = image.convertToFormat(QImage::Format_ARGB32); - - if (image.hasAlphaChannel()) { - maskImage = image.createAlphaMask(); - } else { - maskImage.fill(0xff); - } - maskImage = maskImage.convertToFormat(QImage::Format_Mono); + maskImage.fill(Qt::color1); int nbits = 32; int bpl_bmp = ((image.width()*nbits+31)/32)*4; @@ -671,7 +665,7 @@ bool ICOReader::write(QIODevice *device, const QVector &images) *b++ = qRed(*p); *b++ = qAlpha(*p); if (qAlpha(*p) > 0) // Even mostly transparent pixels must not be masked away - maskImage.setPixel(x, y, Qt::color1); // (i.e. createAlphaMask() takes away too much) + maskImage.setPixel(x, y, 0); p++; x++; } @@ -679,7 +673,6 @@ bool ICOReader::write(QIODevice *device, const QVector &images) } delete[] buf; - maskImage.invertPixels(); // seems as though it needs this // NOTE! !! The mask is only flipped vertically - not horizontally !! for (y = maskImage.height() - 1; y >= 0; y--) buffer.write((char*)maskImage.scanLine(y), maskImage.bytesPerLine()); -- cgit v1.2.3 From 9a77beaea36bf6c8b44086a15bed0e9903a06944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 18 Dec 2019 18:01:27 +0100 Subject: macOS: Deliver theme changes synchronously Otherwise the expose event that AppKit triggers will be delivered before we've propagated the theme change, and we fail to draw the UI using the new theme. Change-Id: I502122a2bf02a866d136106d831f0c2a0dfe26f2 Reviewed-by: Timur Pocheptsov --- src/gui/kernel/qwindowsysteminterface.cpp | 4 ++-- src/gui/kernel/qwindowsysteminterface.h | 1 + src/plugins/platforms/cocoa/qcocoatheme.mm | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index ba04f8701d..8457282bed 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -880,10 +880,10 @@ void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qrea QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleThemeChange(QWindow *window) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleThemeChange, QWindow *window) { QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(window); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } #if QT_CONFIG(draganddrop) diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index d5a4ad30d8..95e20f0f8b 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -249,6 +249,7 @@ public: static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY); static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate); + template static void handleThemeChange(QWindow *window); static void handleFileOpenEvent(const QString& fileName); diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 7c10456824..387df65721 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -129,7 +129,7 @@ void QCocoaTheme::handleSystemThemeChange() QFontCache::instance()->clear(); } - QWindowSystemInterface::handleThemeChange(nullptr); + QWindowSystemInterface::handleThemeChange(nullptr); } bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const -- cgit v1.2.3 From b31aef2900478ef463c65dff5a3ea92b8fc047d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Fri, 13 Dec 2019 16:03:50 +0100 Subject: uic: Rename raise() to raise_() for Python Fixes: QTBUG-80791 Change-Id: Ia6339b8c683147456cdffa7f2d45972e8eacd92c Reviewed-by: Friedemann Kleint --- src/tools/uic/cpp/cppwriteinitialization.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 0349061089..570a61a1f1 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -824,8 +824,8 @@ void WriteInitialization::acceptWidget(DomWidget *node) qPrintable(m_option.messagePrefix()), name.toLatin1().data()); } else { - m_output << m_indent << varName << language::derefPointer << "raise()" - << language::eol; + m_output << m_indent << varName << language::derefPointer + << (language::language() != Language::Python ? "raise()" : "raise_()") << language::eol; } } } -- cgit v1.2.3 From 0f0d26418c185fe9e4c01049d165ac5548305354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 19 Dec 2019 13:51:56 +0100 Subject: High-DPI: restore rounding behavior on Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt 5.14 introduced QApplication::scaleFactorRoundingPolicy, where the default policy rounds the scale factor to an integer, which matches Qt's behavior on Windows and X11. However, Qt has never rounded scale factors on Android. Restore the historical behavior and document the platform difference. Change-Id: I0f8e8fb65e3874338ea290bbb12da350da22f099 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 7adba40fbd..6678b5f0ce 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -148,7 +148,13 @@ QString QGuiApplicationPrivate::styleOverride; Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; Qt::HighDpiScaleFactorRoundingPolicy QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = +#ifdef Q_OS_ANDROID + // On Android, Qt has newer rounded the scale factor. Preserve + // that behavior by disabling rounding by default. + Qt::HighDpiScaleFactorRoundingPolicy::PassThrough; +#else Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor; +#endif bool QGuiApplicationPrivate::highDpiScalingUpdated = false; QPointer QGuiApplicationPrivate::currentDragWindow; @@ -3551,6 +3557,8 @@ Qt::ApplicationState QGuiApplication::applicationState() accessor will reflect the environment, if set. The default value is Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor. + On Qt for Android the default is Qt::HighDpiScaleFactorRoundingPolicy::PassThough, + which preserves historical behavior from earlier Qt versions. */ void QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy) { -- cgit v1.2.3 From 43792c50d4c8de1c30456666cc9ee1c945d67991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 19 Dec 2019 14:05:30 +0100 Subject: =?UTF-8?q?Don=E2=80=99t=20reset=20highDpicaleFactorRoundingPolicy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t reset highDpicaleFactorRoundingPolicy in the QGuiApplication destructior. This is a static property, independent of the application object lifetime. Change-Id: Ibf55e2a6ea1ae6429fce3f0e9d58323111aac374 Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qguiapplication.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 6678b5f0ce..d49f349e7a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -695,8 +695,6 @@ QGuiApplication::~QGuiApplication() QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()}; QGuiApplicationPrivate::currentMousePressWindow = QGuiApplicationPrivate::currentMouseWindow = nullptr; QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; - QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy = - Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor; QGuiApplicationPrivate::highDpiScalingUpdated = false; QGuiApplicationPrivate::currentDragWindow = nullptr; QGuiApplicationPrivate::tabletDevicePoints.clear(); -- cgit v1.2.3 From 9d6b4d11424cdcd6c572cdcc50b3b790b6e673c0 Mon Sep 17 00:00:00 2001 From: Jordi Pujol Foyo Date: Fri, 13 Dec 2019 14:27:11 +0100 Subject: New features for QPdfWriter Added new API setDocumentXmpMetadata/documentXmpMetadata and addFileAttachment [ChangeLog][QtGui][QPdfWriter] New API to provide external document XMP metadata and attach files to PDF. Fixes: QTBUG-78651 Fixes: QTBUG-78764 Change-Id: Ic0b37e8d12899f907001db469080594c14c87655 Reviewed-by: Eirik Aavitsland --- src/gui/painting/qpdf.cpp | 159 ++++++++++++++++++++++++++++++++-------- src/gui/painting/qpdf_p.h | 21 +++++- src/gui/painting/qpdfwriter.cpp | 44 +++++++++++ src/gui/painting/qpdfwriter.h | 5 ++ 4 files changed, 196 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 932c3e6f5a..de9fc13331 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1390,6 +1390,18 @@ void QPdfEngine::setPdfVersion(PdfVersion version) d->pdfVersion = version; } +void QPdfEngine::setDocumentXmpMetadata(const QByteArray &xmpMetadata) +{ + Q_D(QPdfEngine); + d->xmpDocumentMetadata = xmpMetadata; +} + +QByteArray QPdfEngine::documentXmpMetadata() const +{ + Q_D(const QPdfEngine); + return d->xmpDocumentMetadata; +} + void QPdfEngine::setPageLayout(const QPageLayout &pageLayout) { Q_D(QPdfEngine); @@ -1520,6 +1532,8 @@ bool QPdfEngine::begin(QPaintDevice *pdev) d->xrefPositions.clear(); d->pageRoot = 0; + d->embeddedfilesRoot = 0; + d->namesRoot = 0; d->catalog = 0; d->info = 0; d->graphicsState = 0; @@ -1555,10 +1569,18 @@ bool QPdfEngine::end() d->outDevice = nullptr; } + d->fileCache.clear(); + setActive(false); return true; } +void QPdfEngine::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType) +{ + Q_D(QPdfEngine); + d->fileCache.push_back({fileName, data, mimeType}); +} + QPdfEnginePrivate::~QPdfEnginePrivate() { qDeleteAll(fonts); @@ -1586,13 +1608,19 @@ void QPdfEnginePrivate::writeHeader() int metaDataObj = -1; int outputIntentObj = -1; + if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty()) { + metaDataObj = writeXmpDcumentMetaData(); + } if (pdfVersion == QPdfEngine::Version_A1b) { - metaDataObj = writeXmpMetaData(); outputIntentObj = writeOutputIntent(); } catalog = addXrefEntry(-1); pageRoot = requestObject(); + if (!fileCache.isEmpty()) { + namesRoot = requestObject(); + embeddedfilesRoot = requestObject(); + } // catalog { @@ -1602,10 +1630,15 @@ void QPdfEnginePrivate::writeHeader() << "/Type /Catalog\n" << "/Pages " << pageRoot << "0 R\n"; - if (pdfVersion == QPdfEngine::Version_A1b) { - s << "/OutputIntents [" << outputIntentObj << "0 R]\n"; + // Embedded files, if any + if (!fileCache.isEmpty()) + s << "/Names " << embeddedfilesRoot << "0 R\n"; + + if (pdfVersion == QPdfEngine::Version_A1b || !xmpDocumentMetadata.isEmpty()) s << "/Metadata " << metaDataObj << "0 R\n"; - } + + if (pdfVersion == QPdfEngine::Version_A1b) + s << "/OutputIntents [" << outputIntentObj << "0 R]\n"; s << ">>\n" << "endobj\n"; @@ -1613,6 +1646,12 @@ void QPdfEnginePrivate::writeHeader() write(catalog); } + if (!fileCache.isEmpty()) { + addXrefEntry(embeddedfilesRoot); + xprintf("<>\n" + "endobj\n", namesRoot); + } + // graphics state graphicsState = addXrefEntry(-1); xprintf("<<\n" @@ -1664,39 +1703,45 @@ void QPdfEnginePrivate::writeInfo() "endobj\n"); } -int QPdfEnginePrivate::writeXmpMetaData() +int QPdfEnginePrivate::writeXmpDcumentMetaData() { const int metaDataObj = addXrefEntry(-1); + QByteArray metaDataContent; + + 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 = QLatin1String("Z"); - 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 QString metaDataDate = timeStr + tzStr; - 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); + QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml")); + metaDataFile.open(QIODevice::ReadOnly); + metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(), + title.toHtmlEscaped(), + creator.toHtmlEscaped(), + metaDataDate).toUtf8(); + } else - tzStr = QLatin1String("Z"); + metaDataContent = xmpDocumentMetadata; - const QString metaDataDate = timeStr + tzStr; - - QFile metaDataFile(QLatin1String(":/qpdf/qpdfa_metadata.xml")); - metaDataFile.open(QIODevice::ReadOnly); - const QByteArray metaDataContent = QString::fromUtf8(metaDataFile.readAll()).arg(producer.toHtmlEscaped(), - title.toHtmlEscaped(), - creator.toHtmlEscaped(), - metaDataDate).toUtf8(); xprintf("<<\n" "/Type /Metadata /Subtype /XML\n" "/Length %d\n" @@ -1774,6 +1819,56 @@ void QPdfEnginePrivate::writePageRoot() "endobj\n"); } +void QPdfEnginePrivate::writeAttachmentRoot() +{ + if (fileCache.isEmpty()) + return; + + QVector attachments; + const int size = fileCache.size(); + for (int i = 0; i < size; ++i) { + auto attachment = fileCache.at(i); + const int attachmentID = addXrefEntry(-1); + xprintf("<<\n"); + if (do_compress) + xprintf("/Filter /FlateDecode\n"); + + const int lenobj = requestObject(); + xprintf("/Length %d 0 R\n", lenobj); + int len = 0; + xprintf(">>\nstream\n"); + len = writeCompressed(attachment.data); + xprintf("\nendstream\n" + "endobj\n"); + addXrefEntry(lenobj); + xprintf("%d\n" + "endobj\n", len); + + attachments.push_back(addXrefEntry(-1)); + xprintf("<<\n" + "/F (%s)", attachment.fileName.toLatin1().constData()); + + xprintf("\n/EF <>\n" + "/Type/Filespec\n" + , attachmentID); + if (!attachment.mimeType.isEmpty()) + xprintf("/Subtype/%s\n", + attachment.mimeType.replace(QLatin1String("/"), + QLatin1String("#2F")).toLatin1().constData()); + xprintf(">>\nendobj\n"); + } + + // names + addXrefEntry(namesRoot); + xprintf("<>\n" + "endobj\n"); +} void QPdfEnginePrivate::embedFont(QFontSubset *font) { @@ -2031,6 +2126,8 @@ void QPdfEnginePrivate::writeTail() writePage(); writeFonts(); writePageRoot(); + writeAttachmentRoot(); + addXrefEntry(xrefPositions.size(),false); xprintf("xref\n" "0 %d\n" diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 89e549614a..57d70db442 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -187,6 +187,11 @@ public: void setPdfVersion(PdfVersion version); + void setDocumentXmpMetadata(const QByteArray &xmpMetadata); + QByteArray documentXmpMetadata() const; + + void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType); + // reimplementations QPaintEngine bool begin(QPaintDevice *pdev) override; bool end() override; @@ -297,9 +302,10 @@ private: int createShadingFunction(const QGradient *gradient, int from, int to, bool reflect, bool alpha); void writeInfo(); - int writeXmpMetaData(); + int writeXmpDcumentMetaData(); int writeOutputIntent(); void writePageRoot(); + void writeAttachmentRoot(); void writeFonts(); void embedFont(QFontSubset *font); qreal calcUserUnit() const; @@ -324,11 +330,22 @@ private: inline int writeCompressed(const QByteArray &data) { return writeCompressed(data.constData(), data.length()); } int writeCompressed(QIODevice *dev); + struct AttachmentInfo + { + AttachmentInfo (const QString &fileName, const QByteArray &data, const QString &mimeType) + : fileName(fileName), data(data), mimeType(mimeType) {} + QString fileName; + QByteArray data; + QString mimeType; + }; + // various PDF objects - int pageRoot, catalog, info, graphicsState, patternColorSpace; + int pageRoot, embeddedfilesRoot, namesRoot, catalog, info, graphicsState, patternColorSpace; QVector pages; QHash imageCache; QHash, uint > alphaCache; + QVector fileCache; + QByteArray xmpDocumentMetadata; }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 35814d146c..4f70fe6ad2 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -266,6 +266,50 @@ int QPdfWriter::resolution() const return d->engine->resolution(); } +/*! + \since 5.15 + + Sets the document metadata. This metadata is not influenced by the setTitle / setCreator methods, + so is up to the user to keep it consistent. + \a xmpMetadata contains XML formatted metadata to embed into the PDF file. + + \sa documentXmpMetadata() +*/ + +void QPdfWriter::setDocumentXmpMetadata(const QByteArray &xmpMetadata) +{ + Q_D(const QPdfWriter); + d->engine->setDocumentXmpMetadata(xmpMetadata); +} + +/*! + \since 5.15 + + Gets the document metadata, as it was provided with a call to setDocumentXmpMetadata. It will not + return the default metadata. + + \sa setDocumentXmpMetadata() +*/ + +QByteArray QPdfWriter::documentXmpMetadata() const +{ + Q_D(const QPdfWriter); + return d->engine->documentXmpMetadata(); +} + +/*! + \since 5.15 + + Adds \a fileName attachment to the PDF with (optional) \a mimeType + \a data contains the raw file data to embed into the PDF file. +*/ + +void QPdfWriter::addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType) +{ + Q_D(QPdfWriter); + d->engine->addFileAttachment(fileName, data, mimeType); +} + // Defined in QPagedPaintDevice but non-virtual, add QPdfWriter specific doc here #ifdef Q_QDOC /*! diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h index 668081e008..04039a0104 100644 --- a/src/gui/painting/qpdfwriter.h +++ b/src/gui/painting/qpdfwriter.h @@ -75,6 +75,11 @@ public: void setResolution(int resolution); int resolution() const; + void setDocumentXmpMetadata(const QByteArray &xmpMetadata); + QByteArray documentXmpMetadata() const; + + void addFileAttachment(const QString &fileName, const QByteArray &data, const QString &mimeType = QString()); + #ifdef Q_QDOC bool setPageLayout(const QPageLayout &pageLayout); bool setPageSize(const QPageSize &pageSize); -- cgit v1.2.3 From 23d4c0c34b37d9d6d94fedd2fc7316c34a66f10d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 18 Dec 2019 11:25:44 +0100 Subject: Remove some uses of QImage::setAlphaChannel Remove once where it did nothing, and once where using composition mode masking avoids first creating a masking image. Change-Id: Ia4c93eac6ebb11fcdab34d306d943a7f87906b7e Reviewed-by: Eirik Aavitsland --- src/widgets/dialogs/qfilesystemmodel.cpp | 5 ++--- src/widgets/effects/qpixmapfilter.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 914c845565..d658f7fe0c 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -948,9 +948,8 @@ QVariant QFileSystemModel::headerData(int section, Qt::Orientation orientation, if (section == 0) { // ### TODO oh man this is ugly and doesn't even work all the way! // it is still 2 pixels off - QImage pixmap(16, 1, QImage::Format_Mono); - pixmap.fill(0); - pixmap.setAlphaChannel(pixmap.createAlphaMask()); + QImage pixmap(16, 1, QImage::Format_ARGB32_Premultiplied); + pixmap.fill(Qt::transparent); return pixmap; } break; diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 637c9c6aba..1f899c2660 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -1135,8 +1135,12 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q destImage = std::move(buffer); } - if (srcImage.hasAlphaChannel()) - destImage.setAlphaChannel(srcImage.alphaChannel()); + if (srcImage.hasAlphaChannel()) { + Q_ASSERT(destImage.format() == QImage::Format_ARGB32_Premultiplied); + QPainter maskPainter(&destImage); + maskPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + maskPainter.drawImage(0, 0, srcImage); + } painter->drawImage(dest, destImage); } -- cgit v1.2.3 From 5034f8d8d5e05dc1a477d5fabe486a0997679b97 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 19 Dec 2019 09:33:19 -0800 Subject: forkfd: fix build with GCC 4.8 & 4.9 Prior to GCC 5.x, std::atomic_int was a typedef to __atomic_base, which meant we couldn't use it in atomic_compare_exchange that requires pointers to std::atomic. That changed in 5.x (r219790) in response to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60940. Easy fix, though. Fixes: QTBUG-80896 Change-Id: I46bf1f65e8db46afbde5fffd15e1d625154f8d59 Reviewed-by: Ville Voutilainen --- src/3rdparty/forkfd/forkfd_c11.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty/forkfd/forkfd_c11.h b/src/3rdparty/forkfd/forkfd_c11.h index f3dc2b5357..2b1d3f181e 100644 --- a/src/3rdparty/forkfd/forkfd_c11.h +++ b/src/3rdparty/forkfd/forkfd_c11.h @@ -36,7 +36,7 @@ # define FFD_ATOMIC_ACQUIRE std::memory_order_acquire # define FFD_ATOMIC_RELEASE std::memory_order_release // acq_rel & cst not necessary -typedef std::atomic_int ffd_atomic_int; +typedef std::atomic ffd_atomic_int; #else # include # define ffd_atomic_pointer(type) _Atomic(type*) -- cgit v1.2.3 From c24404dbda48bd4f9d6ceb4777fced7b164345fd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Dec 2019 10:10:43 +0100 Subject: Unbreak developer build with clang-cl Move the macro definitions for Q_DECL_UNUSED_MEMBER along with a definition for Q_DECL_UNUSED from the scope excluding icc and cl into a separate one for plain clang and cl since the attributes work with clang-cl as well. Remove the check introduced in 9782938045c33b37fe0bbb6cdf00e406cd3d837e since it is assumed that all clang versions have the attribute now. Fixes: include\QtCore/../../src/corelib/io/qloggingcategory.h(87,32): error: private field 'd' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER void *d; // reserved for future use ^ include\QtCore/../../src/corelib/io/qloggingcategory.h(108,31): error: private field 'placeholder' is not used [-Werror,-Wunused-private-field] Q_DECL_UNUSED_MEMBER bool placeholder[4]; // reserved for future use Task-number: QTBUG-63512 Change-Id: I651771b085408443bb02e96698a980170fcaeb6d Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 60dc7ce688..0091cfcb60 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -828,13 +828,14 @@ # endif # endif -# if defined(__has_warning) -# if __has_warning("-Wunused-private-field") -# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED -# endif -# endif +#endif // Q_CC_CLANG && !Q_CC_INTEL && !Q_CC_MSVC -#endif // Q_CC_CLANG +#if defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) +# ifndef Q_DECL_UNUSED +# define Q_DECL_UNUSED __attribute__((__unused__)) +# endif +# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED +#endif #if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) # define Q_COMPILER_RESTRICTED_VLA -- cgit v1.2.3 From 556712f511a02ff8101e648d2e6f0090231d4f3d Mon Sep 17 00:00:00 2001 From: Jordi Pujol Foyo Date: Wed, 6 Mar 2019 16:46:21 +0100 Subject: Allow hiding tabs in QTabWidget / QTabBar Add 2 methods to set/ask if a tab is hidden. [ChangeLog][QtWidgets][QTabWidget/QTabBar] Tabs can now be hidden with setTabVisible Fixes: QTBUG-63038 Change-Id: I7b07ecdb485e1f6c085d03515ef2b73baae889de Reviewed-by: Christian Ehrlicher --- src/widgets/widgets/qtabbar.cpp | 172 ++++++++++++++++++++++++++++++++----- src/widgets/widgets/qtabbar.h | 3 + src/widgets/widgets/qtabbar_p.h | 9 +- src/widgets/widgets/qtabwidget.cpp | 50 ++++++++++- src/widgets/widgets/qtabwidget.h | 3 + 5 files changed, 212 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 4e75cca704..aff95b0931 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -207,8 +207,8 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex) else option->selectedPosition = QStyleOptionTab::NotAdjacent; - const bool paintBeginning = (tabIndex == 0) || (dragInProgress && tabIndex == pressedIndex + 1); - const bool paintEnd = (tabIndex == totalTabs - 1) || (dragInProgress && tabIndex == pressedIndex - 1); + const bool paintBeginning = (tabIndex == firstVisible) || (dragInProgress && tabIndex == pressedIndex + 1); + const bool paintEnd = (tabIndex == lastVisible - 1) || (dragInProgress && tabIndex == pressedIndex - 1); if (paintBeginning) { if (paintEnd) option->position = QStyleOptionTab::OnlyOneTab; @@ -459,6 +459,7 @@ void QTabBarPrivate::layoutTabs() int i; bool vertTabs = verticalTabs(shape); int tabChainIndex = 0; + int hiddenTabs = 0; Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, nullptr, q)); QVector tabChain(tabList.count() + 2); @@ -484,7 +485,11 @@ void QTabBarPrivate::layoutTabs() int minx = 0; int x = 0; int maxHeight = 0; - for (i = 0; i < tabList.count(); ++i, ++tabChainIndex) { + for (i = 0; i < tabList.count(); ++i) { + if (!tabList.at(i).visible) { + ++hiddenTabs; + continue; + } QSize sz = q->tabSizeHint(i); tabList[i].maxRect = QRect(x, 0, sz.width(), sz.height()); x += sz.width(); @@ -500,6 +505,7 @@ void QTabBarPrivate::layoutTabs() if (!expanding) tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint; + ++tabChainIndex; } last = minx; @@ -509,7 +515,11 @@ void QTabBarPrivate::layoutTabs() int miny = 0; int y = 0; int maxWidth = 0; - for (i = 0; i < tabList.count(); ++i, ++tabChainIndex) { + for (i = 0; i < tabList.count(); ++i) { + if (!tabList.at(i).visible) { + ++hiddenTabs; + continue; + } QSize sz = q->tabSizeHint(i); tabList[i].maxRect = QRect(0, y, sz.width(), sz.height()); y += sz.height(); @@ -525,6 +535,7 @@ void QTabBarPrivate::layoutTabs() if (!expanding) tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint; + ++tabChainIndex; } last = miny; @@ -538,14 +549,20 @@ void QTabBarPrivate::layoutTabs() && (tabAlignment != Qt::AlignRight) && (tabAlignment != Qt::AlignJustify); tabChain[tabChainIndex].empty = true; - Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. + Q_ASSERT(tabChainIndex == tabChain.count() - 1 - hiddenTabs); // add an assert just to make sure. // Do the calculation qGeomCalc(tabChain, 0, tabChain.count(), 0, qMax(available, last), 0); // Use the results + hiddenTabs = 0; for (i = 0; i < tabList.count(); ++i) { - const QLayoutStruct &lstruct = tabChain.at(i + 1); + if (!tabList.at(i).visible) { + tabList[i].rect = QRect(); + ++hiddenTabs; + continue; + } + const QLayoutStruct &lstruct = tabChain.at(i + 1 - hiddenTabs); if (!vertTabs) tabList[i].rect.setRect(lstruct.pos, 0, lstruct.size, maxExtent); else @@ -975,11 +992,15 @@ int QTabBar::insertTab(int index, const QIcon& icon, const QString &text) #ifndef QT_NO_SHORTCUT d->tabList[index].shortcutId = grabShortcut(QKeySequence::mnemonic(text)); #endif + d->firstVisible = qMax(qMin(index, d->firstVisible), 0); + d->lastVisible = qMax(index, d->lastVisible); d->refresh(); if (d->tabList.count() == 1) setCurrentIndex(index); - else if (index <= d->currentIndex) + else if (index <= d->currentIndex) { ++d->currentIndex; + ++d->lastVisible; + } if (d->closeButtonOnTabs) { QStyleOptionTab opt; @@ -1035,6 +1056,9 @@ void QTabBar::removeTab(int index) if (d->tabList[i].lastTab > index) --d->tabList[i].lastTab; } + + d->calculateFirstLastVisible(index, false, true); + if (index == d->currentIndex) { // The current tab is going away, in order to make sure // we emit that "current has changed", we need to reset this @@ -1045,16 +1069,14 @@ void QTabBar::removeTab(int index) case SelectPreviousTab: if (newIndex > index) newIndex--; - if (d->validIndex(newIndex)) + if (d->validIndex(newIndex) && d->tabList.at(newIndex).visible) break; Q_FALLTHROUGH(); case SelectRightTab: - newIndex = index; - if (newIndex >= d->tabList.size()) - newIndex = d->tabList.size() - 1; + newIndex = qBound(d->firstVisible, index, d->lastVisible); break; case SelectLeftTab: - newIndex = index - 1; + newIndex = qBound(d->firstVisible, index-1, d->lastVisible); if (newIndex < 0) newIndex = 0; break; @@ -1118,9 +1140,52 @@ void QTabBar::setTabEnabled(int index, bool enabled) #endif update(); if (!enabled && index == d->currentIndex) - setCurrentIndex(d->validIndex(index+1)?index+1:0); - else if (enabled && !d->validIndex(d->currentIndex)) - setCurrentIndex(index); + setCurrentIndex(d->selectNewCurrentIndexFrom(index+1)); + else if (enabled && !isTabVisible(d->currentIndex)) + setCurrentIndex(d->selectNewCurrentIndexFrom(index)); + } +} + + +/*! + Returns true if the tab at position \a index is visible; otherwise + returns false. + \since 5.15 +*/ +bool QTabBar::isTabVisible(int index) const +{ + Q_D(const QTabBar); + if (d->validIndex(index)) + return d->tabList.at(index).visible; + return false; +} + +/*! + If \a visible is true, make the tab at position \a index visible, + otherwise make it hidden. + \since 5.15 +*/ +void QTabBar::setTabVisible(int index, bool visible) +{ + Q_D(QTabBar); + if (QTabBarPrivate::Tab *tab = d->at(index)) { + d->layoutDirty = (visible != tab->visible); + if (!d->layoutDirty) + return; + tab->visible = visible; + if (tab->leftWidget) + tab->leftWidget->setVisible(visible); + if (tab->rightWidget) + tab->rightWidget->setVisible(visible); +#ifndef QT_NO_SHORTCUT + setShortcutEnabled(tab->shortcutId, visible); +#endif + d->calculateFirstLastVisible(index, visible, false); + if (!visible && index == d->currentIndex) { + const int newindex = d->selectNewCurrentIndexFrom(index+1); + setCurrentIndex(newindex); + } + update(); } } @@ -1291,7 +1356,7 @@ QVariant QTabBar::tabData(int index) const /*! Returns the visual rectangle of the tab at position \a - index, or a null rectangle if \a index is out of range. + index, or a null rectangle if \a index is hidden, or out of range. */ QRect QTabBar::tabRect(int index) const { @@ -1299,6 +1364,8 @@ QRect QTabBar::tabRect(int index) const if (const QTabBarPrivate::Tab *tab = d->at(index)) { if (d->layoutDirty) const_cast(d)->layoutTabs(); + if (!tab->visible) + return QRect(); QRect r = tab->rect; if (verticalTabs(d->shape)) r.translate(0, -d->scrollOffset); @@ -1429,8 +1496,10 @@ QSize QTabBar::sizeHint() const if (d->layoutDirty) const_cast(d)->layoutTabs(); QRect r; - for (int i = 0; i < d->tabList.count(); ++i) - r = r.united(d->tabList.at(i).maxRect); + for (int i = 0; i < d->tabList.count(); ++i) { + if (d->tabList.at(i).visible) + r = r.united(d->tabList.at(i).maxRect); + } QSize sz = QApplication::globalStrut(); return r.size().expandedTo(sz); } @@ -1444,8 +1513,10 @@ QSize QTabBar::minimumSizeHint() const const_cast(d)->layoutTabs(); if (!d->useScrollButtons) { QRect r; - for (int i = 0; i < d->tabList.count(); ++i) - r = r.united(d->tabList.at(i).minRect); + for (int i = 0; i < d->tabList.count(); ++i) { + if (d->tabList.at(i).visible) + r = r.united(d->tabList.at(i).minRect); + } return r.size().expandedTo(QApplication::globalStrut()); } if (verticalTabs(d->shape)) @@ -1746,6 +1817,8 @@ void QTabBar::paintEvent(QPaintEvent *) p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase); for (int i = 0; i < d->tabList.count(); ++i) { + if (!d->at(i)->visible) + continue; QStyleOptionTab tab; initStyleOption(&tab, i); if (d->paintWithOffsets && d->tabList[i].dragOffset != 0) { @@ -1819,6 +1892,65 @@ void QTabBar::paintEvent(QPaintEvent *) } } +/* + When index changes visibility, we have to find first & last visible indexes. + If remove is set, we force both + */ +void QTabBarPrivate::calculateFirstLastVisible(int index, bool visible, bool remove) +{ + if (visible) { + firstVisible = qMin(index, firstVisible); + lastVisible = qMax(index, lastVisible); + } else { + if (remove || (index == firstVisible)) { + firstVisible = -1; + for (int i = 0; i < tabList.count(); ++i) { + if (tabList.at(i).visible) { + firstVisible = i; + break; + } + } + if (firstVisible < 0) + firstVisible = 0; + } + if (remove || (index == lastVisible)) { + lastVisible = -1; + for (int i = tabList.count() - 1; i >= 0; --i) { + if (tabList.at(i).visible) { + lastVisible = i; + break; + } + } + } + } +} + +/* + Selects the new current index starting at "fromIndex". If "fromIndex" is visible we're done. + Else it tries any index AFTER fromIndex, then any BEFORE fromIndex and, if everything fails, + it returns -1 indicating that no index is available + */ +int QTabBarPrivate::selectNewCurrentIndexFrom(int fromIndex) +{ + int newindex = -1; + for (int i = fromIndex; i < tabList.count(); ++i) { + if (at(i)->visible && at(i)->enabled) { + newindex = i; + break; + } + } + if (newindex < 0) { + for (int i = fromIndex-1; i > -1; --i) { + if (at(i)->visible && at(i)->enabled) { + newindex = i; + break; + } + } + } + + return newindex; +} + /* Given that index at position from moved to position to where return where index goes. */ diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index fc619355f0..c49c12f38c 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -105,6 +105,9 @@ public: bool isTabEnabled(int index) const; void setTabEnabled(int index, bool); + bool isTabVisible(int index) const; + void setTabVisible(int index, bool); + QString tabText(int index) const; void setTabText(int index, const QString &text); diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index 6f77579108..ac4cbd32a8 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -88,7 +88,7 @@ class Q_WIDGETS_EXPORT QTabBarPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QTabBar) public: QTabBarPrivate() - :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), + :currentIndex(-1), pressedIndex(-1), firstVisible(0), lastVisible(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), drawBase(true), scrollOffset(0), hoverIndex(-1), elideModeSetByUser(false), useScrollButtonsSetByUser(false), expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), autoHide(false), changeCurrentOnDrag(false), @@ -97,6 +97,8 @@ public: int currentIndex; int pressedIndex; + int firstVisible; + int lastVisible; QTabBar::Shape shape; bool layoutDirty; bool drawBase; @@ -104,7 +106,7 @@ public: struct Tab { inline Tab(const QIcon &ico, const QString &txt) - : enabled(true) , shortcutId(0), text(txt), icon(ico), + : enabled(true) , visible(true), shortcutId(0), text(txt), icon(ico), leftWidget(nullptr), rightWidget(nullptr), lastTab(-1), dragOffset(0) #if QT_CONFIG(animation) , animation(nullptr) @@ -112,6 +114,7 @@ public: {} bool operator==(const Tab &other) const { return &other == this; } bool enabled; + bool visible; int shortcutId; QString text; #ifndef QT_NO_TOOLTIP @@ -170,6 +173,8 @@ public: QList tabList; mutable QHash textSizes; + void calculateFirstLastVisible(int index, bool visible, bool remove); + int selectNewCurrentIndexFrom(int currentIndex); int calculateNewPosition(int from, int to, int index) const; void slide(int from, int to); void init(); diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 28c91a89e7..5b3dcfa45b 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -544,8 +544,8 @@ bool QTabWidget::isTabEnabled(int index) const } /*! - If \a enable is true, the page at position \a index is enabled; otherwise the page at position \a index is - disabled. The page's tab is redrawn appropriately. + If \a enable is true, the page at position \a index is enabled; otherwise the page at + position \a index is disabled. The page's tab is redrawn appropriately. QTabWidget uses QWidget::setEnabled() internally, rather than keeping a separate flag. @@ -565,6 +565,44 @@ void QTabWidget::setTabEnabled(int index, bool enable) widget->setEnabled(enable); } +/*! + Returns true if the page at position \a index is visible; otherwise returns false. + + \sa setTabVisible() + \since 5.15 +*/ + +bool QTabWidget::isTabVisible(int index) const +{ + Q_D(const QTabWidget); + return d->tabs->isTabVisible(index); +} + +/*! + If \a enable is true, the page at position \a index is visible; otherwise the page at + position \a index is hidden. The page's tab is redrawn appropriately. + + \sa isTabVisible() + \since 5.15 +*/ + +void QTabWidget::setTabVisible(int index, bool visible) +{ + Q_D(QTabWidget); + QWidget *widget = d->stack->widget(index); + bool currentVisible = d->tabs->isTabVisible(d->tabs->currentIndex()); + d->tabs->setTabVisible(index, visible); + if (!visible) { + if (widget) + widget->setVisible(false); + } else if (!currentVisible) { + setCurrentIndex(index); + if (widget) + widget->setVisible(true); + } + setUpLayout(); +} + /*! \fn void QTabWidget::setCornerWidget(QWidget *widget, Qt::Corner corner) @@ -848,7 +886,13 @@ QSize QTabWidget::sizeHint() const QTabWidget *that = const_cast(this); that->setUpLayout(true); } - QSize s(d->stack->sizeHint()); + QSize s; + for (int i=0; i< d->stack->count(); ++i) { + if (const QWidget* w = d->stack->widget(i)) { + if (d->tabs->isTabVisible(i)) + s = s.expandedTo(w->sizeHint()); + } + } QSize t; if (!d->isAutoHidden()) { t = d->tabs->sizeHint(); diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index f55e71488b..e6b3f93303 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -82,6 +82,9 @@ public: bool isTabEnabled(int index) const; void setTabEnabled(int index, bool); + bool isTabVisible(int index) const; + void setTabVisible(int index, bool); + QString tabText(int index) const; void setTabText(int index, const QString &); -- cgit v1.2.3 From a2ddd96ac8b7657c2ef64f2a8f51db5cd8a8d96a Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 18 Dec 2019 20:23:11 +0100 Subject: Introduce QString(View)::isValidUtf16 QString(View)s can be built or manipulated in ways that make them contain/refer to improperly encoded UTF-16 data. Problem is, we don't have public APIs to check whether a string contains valid UTF-16. This knowledge is precious if the string is to be fed in algorithms, regular expressions, etc. that expect validated input (e.g. QRegularExpression can be faster if it can assume valid UTF-16, otherwise it has to employ extra checks). Add a function that does the validation. [ChangeLog][QtCore][QStringView] Added QStringView::isValidUtf16. [ChangeLog][QtCore][QString] Added QString::isValidUtf16. Change-Id: Idd699183f6ec08013046c76c6a5a7c524b6c6fbc Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.cpp | 29 +++++++++++++++++++++++++++++ src/corelib/text/qstring.h | 2 ++ src/corelib/text/qstringalgorithms.h | 1 + src/corelib/text/qstringview.cpp | 15 +++++++++++++++ src/corelib/text/qstringview.h | 2 ++ 5 files changed, 49 insertions(+) (limited to 'src') diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 4d83f19db7..82b2c10a93 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -591,6 +591,20 @@ bool QtPrivate::isLatin1(QStringView s) noexcept return true; } +bool QtPrivate::isValidUtf16(QStringView s) noexcept +{ + Q_CONSTEXPR uint InvalidCodePoint = UINT_MAX; + + QStringIterator i(s); + while (i.hasNext()) { + uint c = i.next(InvalidCodePoint); + if (c == InvalidCodePoint) + return false; + } + + return true; +} + // conversion between Latin 1 and UTF-16 void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept { @@ -9046,6 +9060,21 @@ bool QString::isRightToLeft() const return QtPrivate::isRightToLeft(QStringView(*this)); } +/*! + \fn bool QString::isValidUtf16() const noexcept + \since 5.15 + + Returns \c true if the string contains valid UTF-16 encoded data, + or \c false otherwise. + + Note that this function does not perform any special validation of the + data; it merely checks if it can be successfully decoded from UTF-16. + The data is assumed to be in host byte order; the presence of a BOM + is meaningless. + + \sa QStringView::isValidUtf16() +*/ + /*! \fn QChar *QString::data() Returns a pointer to the data stored in the QString. The pointer diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 1669d7c94a..1f4e856660 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -919,6 +919,8 @@ public: bool isSimpleText() const; bool isRightToLeft() const; + Q_REQUIRED_RESULT bool isValidUtf16() const noexcept + { return QStringView(*this).isValidUtf16(); } QString(int size, Qt::Initialization); Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {} diff --git a/src/corelib/text/qstringalgorithms.h b/src/corelib/text/qstringalgorithms.h index d54e376aa9..0b7774b4f3 100644 --- a/src/corelib/text/qstringalgorithms.h +++ b/src/corelib/text/qstringalgorithms.h @@ -99,6 +99,7 @@ Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QLatin1String Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isAscii(QStringView s) noexcept; Q_REQUIRED_RESULT Q_DECL_CONSTEXPR inline bool isLatin1(QLatin1String s) noexcept; Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isLatin1(QStringView s) noexcept; +Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isValidUtf16(QStringView s) noexcept; } // namespace QtPRivate diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index 75de827583..c4ddb06ea4 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -864,6 +864,21 @@ QT_BEGIN_NAMESPACE \sa QString::isRightToLeft() */ +/*! + \fn bool QStringView::isValidUtf16() const + \since 5.15 + + Returns \c true if the string contains valid UTF-16 encoded data, + or \c false otherwise. + + Note that this function does not perform any special validation of the + data; it merely checks if it can be successfully decoded from UTF-16. + The data is assumed to be in host byte order; the presence of a BOM + is meaningless. + + \sa QString::isValidUtf16() +*/ + /*! \fn QStringView::toWCharArray(wchar_t *array) const \since 5.14 diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 4ab4d2570f..06391ffef4 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -294,6 +294,8 @@ public: Q_REQUIRED_RESULT bool isRightToLeft() const noexcept { return QtPrivate::isRightToLeft(*this); } + Q_REQUIRED_RESULT bool isValidUtf16() const noexcept + { return QtPrivate::isValidUtf16(*this); } Q_REQUIRED_RESULT inline int toWCharArray(wchar_t *array) const; // defined in qstring.h -- cgit v1.2.3 From c7ecff04609dd7d9282fa5de3d5d1e1fd189b4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 19 Dec 2019 12:28:33 +0100 Subject: Simplify QApplication::palette Change-Id: I1f1be554a72a385985eeee0b79b49acdfcf40d8e Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 9b1202c491..a74b45f377 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1354,15 +1354,14 @@ QPalette QApplication::palette(const QWidget* w) */ QPalette QApplication::palette(const char *className) { - if (!QApplicationPrivate::app_pal) - palette(); PaletteHash *hash = app_palettes(); if (className && hash && hash->size()) { QHash::ConstIterator it = hash->constFind(className); if (it != hash->constEnd()) return *it; } - return *QApplicationPrivate::app_pal; + + return QGuiApplication::palette(); } void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash) -- cgit v1.2.3 From 761025d08c32f3dddbd2d32f00b71f6411dd40ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 19 Dec 2019 12:28:46 +0100 Subject: Contain Qt::AA_SetPalette logic in QApplicationPrivate::setPalette_helper Change-Id: I88b36e800139389895ecb1a15553207a24b3e3a4 Reviewed-by: Timur Pocheptsov --- src/widgets/kernel/qapplication.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index a74b45f377..bf3cf090ba 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1380,6 +1380,10 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* QApplicationPrivate::app_pal = new QPalette(pal); else *QApplicationPrivate::app_pal = pal; + + if (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal)) + QCoreApplication::setAttribute(Qt::AA_SetPalette); + if (hash && hash->size()) { all = true; if (clearWidgetPaletteHash) @@ -1389,9 +1393,6 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* hash->insert(className, pal); } - if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) - QCoreApplication::setAttribute(Qt::AA_SetPalette); - if (qApp) qApp->d_func()->sendApplicationPaletteChange(all, className); } -- cgit v1.2.3 From 7e7f76bc553fc29858262ec1946ef413adfad718 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Fri, 20 Dec 2019 13:39:24 +0100 Subject: QMacStyle: fix tab widget's tab bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alas, this thing strikes back: I have to use clip to remove the part of NSBox coming through the transparent buttons, but this works (as I've noticed recently) only for 'North' and 'West' tab positions. For 'South' and 'East' different geomety adjustments are required. Change-Id: Id1f77bc1869e82e710132a2f4402cc3c8be3ab01 Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 93d2681fd8..5aa7befb84 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -236,6 +236,18 @@ static QLinearGradient titlebarGradientInactive() } #if QT_CONFIG(tabwidget) +/* + Since macOS 10.14 AppKit is using transparency more extensively, especially for the + dark theme. Inactive buttons, for example, are semi-transparent. And we use them to + draw tab widget's tab bar. The combination of NSBox (also a part of tab widget) + and these transparent buttons gives us an undesired side-effect: an outline of + NSBox is visible through transparent buttons. To avoid this, we have this hack below: + we clip the area where the line would be visible through the buttons. The area we + want to clip away can be described as an intersection of the option's rect and + the tab widget's tab bar rect. But some adjustments are required, since those rects + are anyway adjusted during the rendering and they are not exactly what you'll see on + the screen. Thus this switch-statement inside. +*/ static void clipTabBarFrame(const QStyleOption *option, const QMacStyle *style, CGContextRef ctx) { Q_ASSERT(option); @@ -246,7 +258,19 @@ static void clipTabBarFrame(const QStyleOption *option, const QMacStyle *style, QTabWidget *tabWidget = qobject_cast(option->styleObject); Q_ASSERT(tabWidget); - const QRect tabBarRect = style->subElementRect(QStyle::SE_TabWidgetTabBar, option, tabWidget).adjusted(2, 2, -3, -2); + QRect tabBarRect = style->subElementRect(QStyle::SE_TabWidgetTabBar, option, tabWidget).adjusted(2, 0, -3, 0); + switch (tabWidget->tabPosition()) { + case QTabWidget::South: + tabBarRect.setY(tabBarRect.y() + tabBarRect.height() / 2); + break; + case QTabWidget::North: + case QTabWidget::West: + tabBarRect = tabBarRect.adjusted(0, 2, 0, -2); + break; + case QTabWidget::East: + tabBarRect = tabBarRect.adjusted(tabBarRect.width() / 2, 2, tabBarRect.width() / 2, -2); + } + const QRegion clipPath = QRegion(option->rect) - tabBarRect; QVarLengthArray cgRects; for (const QRect &qtRect : clipPath) -- cgit v1.2.3 From 7ac4e55cb979dff890f1575e771e5f2def9e3131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 20 Dec 2019 16:46:24 +0100 Subject: macOS Don't throw away backingstore buffers when backing properties change Clients such as QtWidgets that do their own dirty tracking will assume they can just flush in response to the expose event, without repainting anything. Since we have no way at the moment to inform these clients that the backingstore content might be invalid we can't just throw it away. It turns out that to pick up changes in color spaces we can just tag the existing buffers with the new color space, so we don't need to throw it away. And for the older surface-backed mode we tag the color space on flush, so we didn't need to invalidate anything in the first place. Fixes: QTBUG-80844 Task-number: QTBUG-77749 Change-Id: Icb1ceb178894bb43887cdf03fb855d2d614b5ab0 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoabackingstore.h | 6 ++-- src/plugins/platforms/cocoa/qcocoabackingstore.mm | 36 ++++++++++------------ src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 ++ .../platforms/cocoa/qiosurfacegraphicsbuffer.h | 4 ++- .../platforms/cocoa/qiosurfacegraphicsbuffer.mm | 14 +++++---- 5 files changed, 32 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h index a874936ce6..b57deacb57 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -54,8 +54,6 @@ class QCocoaBackingStore : public QRasterBackingStore protected: QCocoaBackingStore(QWindow *window); QCFType colorSpace() const; - QMacNotificationObserver m_backingPropertiesObserver; - virtual void backingPropertiesChanged() = 0; }; class QNSWindowBackingStore : public QCocoaBackingStore @@ -71,7 +69,6 @@ private: bool windowHasUnifiedToolbar() const; QImage::Format format() const override; void redrawRoundedBottomCorners(CGRect) const; - void backingPropertiesChanged() override; }; class QCALayerBackingStore : public QCocoaBackingStore @@ -118,7 +115,8 @@ private: bool recreateBackBufferIfNeeded(); bool prepareForFlush(); - void backingPropertiesChanged() override; + void backingPropertiesChanged(); + QMacNotificationObserver m_backingPropertiesObserver; std::list> m_buffers; }; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index b17302a640..8a815a7665 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -51,17 +51,6 @@ QT_BEGIN_NAMESPACE QCocoaBackingStore::QCocoaBackingStore(QWindow *window) : QRasterBackingStore(window) { - // Ideally this would be plumbed from the platform layer to QtGui, and - // the QBackingStore would be recreated, but we don't have that code yet, - // so at least make sure we invalidate our backingstore when the backing - // properties (color space e.g.) are changed. - NSView *view = static_cast(window->handle())->view(); - m_backingPropertiesObserver = QMacNotificationObserver(view.window, - NSWindowDidChangeBackingPropertiesNotification, [this]() { - qCDebug(lcQpaBackingStore) << "Backing properties for" - << this->window() << "did change"; - backingPropertiesChanged(); - }); } QCFType QCocoaBackingStore::colorSpace() const @@ -341,11 +330,6 @@ void QNSWindowBackingStore::redrawRoundedBottomCorners(CGRect windowRect) const #endif } -void QNSWindowBackingStore::backingPropertiesChanged() -{ - m_image = QImage(); -} - // ---------------------------------------------------------------------------- QCALayerBackingStore::QCALayerBackingStore(QWindow *window) @@ -353,6 +337,18 @@ QCALayerBackingStore::QCALayerBackingStore(QWindow *window) { qCDebug(lcQpaBackingStore) << "Creating QCALayerBackingStore for" << window; m_buffers.resize(1); + + // Ideally this would be plumbed from the platform layer to QtGui, and + // the QBackingStore would be recreated, but we don't have that code yet, + // so at least make sure we update our backingstore when the backing + // properties (color space e.g.) are changed. + NSView *view = static_cast(window->handle())->view(); + m_backingPropertiesObserver = QMacNotificationObserver(view.window, + NSWindowDidChangeBackingPropertiesNotification, [this]() { + qCDebug(lcQpaBackingStore) << "Backing properties for" + << this->window() << "did change"; + backingPropertiesChanged(); + }); } QCALayerBackingStore::~QCALayerBackingStore() @@ -620,8 +616,9 @@ QImage QCALayerBackingStore::toImage() const void QCALayerBackingStore::backingPropertiesChanged() { - m_buffers.clear(); - m_buffers.resize(1); + qCDebug(lcQpaBackingStore) << "Updating color space of existing buffers"; + for (auto &buffer : m_buffers) + buffer->setColorSpace(colorSpace()); } QPlatformGraphicsBuffer *QCALayerBackingStore::graphicsBuffer() const @@ -698,10 +695,11 @@ bool QCALayerBackingStore::prepareForFlush() QCALayerBackingStore::GraphicsBuffer::GraphicsBuffer(const QSize &size, qreal devicePixelRatio, const QPixelFormat &format, QCFType colorSpace) - : QIOSurfaceGraphicsBuffer(size, format, colorSpace) + : QIOSurfaceGraphicsBuffer(size, format) , dirtyRegion(0, 0, size.width() / devicePixelRatio, size.height() / devicePixelRatio) , m_devicePixelRatio(devicePixelRatio) { + setColorSpace(colorSpace); } QImage *QCALayerBackingStore::GraphicsBuffer::asImage() diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index b7f15a2bf1..d8c931e9a1 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -396,6 +396,8 @@ QVariant QCocoaIntegration::styleHint(StyleHint hint) const return QCoreTextFontEngine::fontSmoothingGamma(); case ShowShortcutsInContextMenus: return QVariant(false); + // case CursorFlashTime: + // return 50000; default: break; } diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h index 872773cb7a..e070ba977d 100644 --- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h +++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h @@ -48,9 +48,11 @@ QT_BEGIN_NAMESPACE class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer { public: - QIOSurfaceGraphicsBuffer(const QSize &size, const QPixelFormat &format, QCFType colorSpace); + QIOSurfaceGraphicsBuffer(const QSize &size, const QPixelFormat &format); ~QIOSurfaceGraphicsBuffer(); + void setColorSpace(QCFType colorSpace); + const uchar *data() const override; uchar *data() override; int bytesPerLine() const override; diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm index a367487e85..285e316d4a 100644 --- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm +++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(lcQpaIOSurface, "qt.qpa.backingstore.iosurface"); -QIOSurfaceGraphicsBuffer::QIOSurfaceGraphicsBuffer(const QSize &size, const QPixelFormat &format, QCFType colorSpace) +QIOSurfaceGraphicsBuffer::QIOSurfaceGraphicsBuffer(const QSize &size, const QPixelFormat &format) : QPlatformGraphicsBuffer(size, format) { const size_t width = size.width(); @@ -81,17 +81,19 @@ QIOSurfaceGraphicsBuffer::QIOSurfaceGraphicsBuffer(const QSize &size, const QPix Q_ASSERT(size_t(bytesPerLine()) == bytesPerRow); Q_ASSERT(size_t(byteCount()) == totalBytes); - - if (colorSpace) { - IOSurfaceSetValue(m_surface, CFSTR("IOSurfaceColorSpace"), - QCFType(CGColorSpaceCopyPropertyList(colorSpace))); - } } QIOSurfaceGraphicsBuffer::~QIOSurfaceGraphicsBuffer() { } +void QIOSurfaceGraphicsBuffer::setColorSpace(QCFType colorSpace) +{ + Q_ASSERT(colorSpace); + IOSurfaceSetValue(m_surface, CFSTR("IOSurfaceColorSpace"), + QCFType(CGColorSpaceCopyPropertyList(colorSpace))); +} + const uchar *QIOSurfaceGraphicsBuffer::data() const { return (const uchar *)IOSurfaceGetBaseAddress(m_surface); -- cgit v1.2.3 From e0b9beb63dead017b6849ebcaa91c04a57f955c6 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 23 Dec 2019 14:41:50 +0100 Subject: QFileInfoGatherer: don't pass empty list to QFileSystemWatcher When an empty list is passed to QFileSystemWatcher::unwatchPaths() a warning is printed out. To avoid this, check if the container is not empty before calling unwatchPaths() Fixes: QTBUG-80965 Change-Id: I23a7946e1e16a8d899abf6cce6b75a6f3662ca0f Reviewed-by: David Faure --- src/widgets/dialogs/qfileinfogatherer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 0beca82f28..7342efbd0d 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -232,7 +232,7 @@ void QFileInfoGatherer::watchPaths(const QStringList &paths) void QFileInfoGatherer::unwatchPaths(const QStringList &paths) { #if QT_CONFIG(filesystemwatcher) - if (m_watcher) + if (m_watcher && !paths.isEmpty()) m_watcher->removePaths(paths); #else Q_UNUSED(paths); -- cgit v1.2.3 From 2ad3348031d8a622374920eac5bdd8fb9ecefcd7 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 21 Dec 2019 19:57:45 +0100 Subject: QPrintDialog: don't access dangling pointer when cups is disabled When no cups support is available, ui.pagesRadioButton is destroyed in QPrintDialogPrivate::init() but was accessed later on. Fix it by moving the cups check one line above. Fixes: QTBUG-80945 Change-Id: Ieb062b39e1461f39665ef612dfea1d7757274b7e Reviewed-by: Timur Pocheptsov --- src/printsupport/dialogs/qprintdialog_unix.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index c7328d9732..7bbf137977 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -637,8 +637,10 @@ void QPrintDialogPrivate::init() options.pageSetCombo->addItem(tr("Odd Pages"), QVariant::fromValue(QCUPSSupport::OddPages)); options.pageSetCombo->addItem(tr("Even Pages"), QVariant::fromValue(QCUPSSupport::EvenPages)); #else - for (int i = options.pagesLayout->count() - 1; i >= 0; --i) - delete options.pagesLayout->itemAt(i)->widget(); + delete options.pagesRadioButton; + delete options.pagesLineEdit; + options.pagesRadioButton = nullptr; + options.pagesLineEdit = nullptr; #endif top->d->setOptionsPane(this); @@ -727,12 +729,12 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma else options.pageSetCombo->setEnabled(true); +#if QT_CONFIG(cups) // Disable complex page ranges widget when printing to pdf // It doesn't work since it relies on cups to do the heavy lifting and cups // is not used when printing to PDF options.pagesRadioButton->setEnabled(outputFormat != QPrinter::PdfFormat); -#if QT_CONFIG(cups) // Disable color options on main dialog if not printing to file, it will be handled by CUPS advanced dialog options.colorMode->setVisible(outputFormat == QPrinter::PdfFormat); #endif -- cgit v1.2.3 From d24a1d4323e73400ef4ecca99e03ff0f41c60389 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 24 Dec 2019 12:29:53 +0100 Subject: QRegularExpression: improve docs about porting from QRegExp Change-Id: Ie5d737188977b0e4dc1070c2d7329d0ecb6a9308 Reviewed-by: David Faure --- src/corelib/text/qregularexpression.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 8d2187eb28..a02d471134 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -443,6 +443,38 @@ QT_BEGIN_NAMESPACE Other differences are outlined below. + \section2 Different pattern syntax + + Porting a regular expression from QRegExp to QRegularExpression may require + changes to the pattern itself. + + In certain scenarios, QRegExp was too lenient and accepted patterns that + are simply invalid when using QRegularExpression. These are somehow easy + to detect, because the QRegularExpression objects built with these patterns + are not valid (cf. isValid()). + + In other cases, a pattern ported from QRegExp to QRegularExpression may + silently change semantics. Therefore, it is necessary to review the + patterns used. The most notable cases of silent incompatibility are: + + \list + + \li Curly braces are needed in order to use a hexadecimal escape like + \c{\xHHHH} with more than 2 digits. A pattern like \c{\x2022} neeeds to + be ported to \c{\x{2022}}, or it will match a space (\c{0x20}) followed + by the string \c{"22"}. In general, it is highly recommended to always use + curly braces with the \c{\\x} escape, no matter the amount of digits + specified. + + \li A 0-to-n quantification like \c{{,n}} needs to be ported to c{{0,n}} to + preserve semantics. Otherwise, a pattern such as \c{\d{,3}} would + actually match a digit followed by the exact string \c{"{,3}"}. + + \li QRegExp by default does Unicode-aware matching, while + QRegularExpression requires a separate option; see below for more details. + + \endlist + \section2 Porting from QRegExp::exactMatch() QRegExp::exactMatch() in Qt 4 served two purposes: it exactly matched -- cgit v1.2.3 From 25101f0984e86aa30f34773eb5b2025f58086b71 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 23 Nov 2019 15:04:47 +0100 Subject: Update PCRE2 to 10.34 Also adjust the import script to handle new files. The RTEMS patch is not upstreamed and had to be-reapplied. Change-Id: Ie3102d56a25674b50c67edd3cce25ffe7040a215 Reviewed-by: Thiago Macieira --- src/3rdparty/pcre2/import_from_pcre2_tarball.sh | 2 + src/3rdparty/pcre2/qt_attribution.json | 8 +- src/3rdparty/pcre2/src/pcre2.h | 19 +- src/3rdparty/pcre2/src/pcre2_auto_possess.c | 7 + src/3rdparty/pcre2/src/pcre2_compile.c | 535 +- src/3rdparty/pcre2/src/pcre2_context.c | 2 +- src/3rdparty/pcre2/src/pcre2_dfa_match.c | 129 +- src/3rdparty/pcre2/src/pcre2_error.c | 3 + src/3rdparty/pcre2/src/pcre2_internal.h | 105 +- src/3rdparty/pcre2/src/pcre2_intmodedep.h | 10 +- src/3rdparty/pcre2/src/pcre2_jit_compile.c | 2015 +++---- src/3rdparty/pcre2/src/pcre2_jit_match.c | 1 - src/3rdparty/pcre2/src/pcre2_jit_neon_inc.h | 321 ++ src/3rdparty/pcre2/src/pcre2_jit_simd_inc.h | 993 ++++ src/3rdparty/pcre2/src/pcre2_maketables.c | 11 + src/3rdparty/pcre2/src/pcre2_match.c | 603 ++- src/3rdparty/pcre2/src/pcre2_match_data.c | 15 +- src/3rdparty/pcre2/src/pcre2_study.c | 306 +- src/3rdparty/pcre2/src/pcre2_tables.c | 316 +- src/3rdparty/pcre2/src/pcre2_ucd.c | 5623 ++++++++++---------- src/3rdparty/pcre2/src/pcre2_ucp.h | 7 +- src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h | 4 + src/3rdparty/pcre2/src/sljit/sljitExecAllocator.c | 28 +- src/3rdparty/pcre2/src/sljit/sljitLir.c | 69 +- src/3rdparty/pcre2/src/sljit/sljitLir.h | 22 +- src/3rdparty/pcre2/src/sljit/sljitNativeARM_32.c | 126 +- src/3rdparty/pcre2/src/sljit/sljitNativeARM_64.c | 111 +- .../pcre2/src/sljit/sljitNativeARM_T2_32.c | 76 +- src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_32.c | 2 + .../pcre2/src/sljit/sljitNativeMIPS_common.c | 155 +- src/3rdparty/pcre2/src/sljit/sljitNativePPC_32.c | 2 + src/3rdparty/pcre2/src/sljit/sljitNativePPC_64.c | 3 - .../pcre2/src/sljit/sljitNativePPC_common.c | 214 +- src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_32.c | 2 + .../pcre2/src/sljit/sljitNativeSPARC_common.c | 102 +- src/3rdparty/pcre2/src/sljit/sljitNativeX86_32.c | 4 +- src/3rdparty/pcre2/src/sljit/sljitNativeX86_64.c | 54 +- .../pcre2/src/sljit/sljitNativeX86_common.c | 125 +- src/3rdparty/pcre2/src/sljit/sljitUtils.c | 6 + 39 files changed, 7425 insertions(+), 4711 deletions(-) create mode 100644 src/3rdparty/pcre2/src/pcre2_jit_neon_inc.h create mode 100644 src/3rdparty/pcre2/src/pcre2_jit_simd_inc.h (limited to 'src') diff --git a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh index 438efe9535..3ff1335cc6 100755 --- a/src/3rdparty/pcre2/import_from_pcre2_tarball.sh +++ b/src/3rdparty/pcre2/import_from_pcre2_tarball.sh @@ -103,6 +103,8 @@ FILES=" src/pcre2_pattern_info.c src/pcre2_script_run.c src/pcre2_serialize.c + src/pcre2_jit_neon_inc.h + src/pcre2_jit_simd_inc.h src/pcre2_string_utils.c src/pcre2_study.c src/pcre2_substitute.c diff --git a/src/3rdparty/pcre2/qt_attribution.json b/src/3rdparty/pcre2/qt_attribution.json index a22136c06c..12213ba5a7 100644 --- a/src/3rdparty/pcre2/qt_attribution.json +++ b/src/3rdparty/pcre2/qt_attribution.json @@ -7,8 +7,8 @@ "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.", "Homepage": "http://www.pcre.org/", - "Version": "10.33", - "DownloadLocation": "https://ftp.pcre.org/pub/pcre/pcre2-10.33.tar.bz2", + "Version": "10.34", + "DownloadLocation": "https://ftp.pcre.org/pub/pcre/pcre2-10.34.tar.bz2", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENCE", @@ -24,8 +24,8 @@ Copyright (c) 2010-2019 Zoltan Herczeg" "Path": "src/sljit", "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.", "Homepage": "http://www.pcre.org/", - "Version": "10.33", - "DownloadLocation": "https://ftp.pcre.org/pub/pcre/pcre2-10.33.tar.bz2", + "Version": "10.34", + "DownloadLocation": "https://ftp.pcre.org/pub/pcre/pcre2-10.34.tar.bz2", "License": "BSD 2-clause \"Simplified\" License", "LicenseId": "BSD-2-Clause", "LicenseFile": "LICENCE", diff --git a/src/3rdparty/pcre2/src/pcre2.h b/src/3rdparty/pcre2/src/pcre2.h index 102b5d91f1..cb9d61a35b 100644 --- a/src/3rdparty/pcre2/src/pcre2.h +++ b/src/3rdparty/pcre2/src/pcre2.h @@ -5,7 +5,7 @@ /* This is the public header file for the PCRE library, second API, to be #included by applications that call PCRE2 functions. - Copyright (c) 2016-2018 University of Cambridge + Copyright (c) 2016-2019 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -42,9 +42,9 @@ POSSIBILITY OF SUCH DAMAGE. /* The current PCRE version information. */ #define PCRE2_MAJOR 10 -#define PCRE2_MINOR 33 +#define PCRE2_MINOR 34 #define PCRE2_PRERELEASE -#define PCRE2_DATE 2019-04-16 +#define PCRE2_DATE 2019-11-21 /* When an application links to a PCRE DLL in Windows, the symbols that are imported have to be identified as such. When building PCRE2, the appropriate @@ -142,6 +142,7 @@ D is inspected during pcre2_dfa_match() execution #define PCRE2_USE_OFFSET_LIMIT 0x00800000u /* J M D */ #define PCRE2_EXTENDED_MORE 0x01000000u /* C */ #define PCRE2_LITERAL 0x02000000u /* C */ +#define PCRE2_MATCH_INVALID_UTF 0x04000000u /* J M D */ /* An additional compile options word is available in the compile context. */ @@ -305,6 +306,8 @@ pcre2_pattern_convert(). */ #define PCRE2_ERROR_INVALID_HYPHEN_IN_OPTIONS 194 #define PCRE2_ERROR_ALPHA_ASSERTION_UNKNOWN 195 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE 196 +#define PCRE2_ERROR_TOO_MANY_CAPTURES 197 +#define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED 198 /* "Expected" matching error codes: no match and partial match. */ @@ -390,6 +393,7 @@ released, the numbers must not be changed. */ #define PCRE2_ERROR_HEAPLIMIT (-63) #define PCRE2_ERROR_CONVERT_SYNTAX (-64) #define PCRE2_ERROR_INTERNAL_DUPMATCH (-65) +#define PCRE2_ERROR_DFA_UINVALID_UTF (-66) /* Request types for pcre2_pattern_info() */ @@ -580,7 +584,7 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_bsr(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ - pcre2_set_character_tables(pcre2_compile_context *, const unsigned char *); \ + pcre2_set_character_tables(pcre2_compile_context *, const uint8_t *); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_set_compile_extra_options(pcre2_compile_context *, uint32_t); \ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ @@ -675,6 +679,8 @@ PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ pcre2_match_data_free(pcre2_match_data *); \ PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \ pcre2_get_mark(pcre2_match_data *); \ +PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \ + pcre2_get_match_data_size(pcre2_match_data *); \ PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \ pcre2_get_ovector_count(pcre2_match_data *); \ PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \ @@ -773,7 +779,8 @@ PCRE2_EXP_DECL int PCRE2_CALL_CONVENTION \ pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \ PCRE2_EXP_DECL const uint8_t PCRE2_CALL_CONVENTION \ *pcre2_maketables(pcre2_general_context *); \ - +PCRE2_EXP_DECL void PCRE2_CALL_CONVENTION \ + pcre2_maketables_free(pcre2_general_context *, const uint8_t *); /* Define macros that generate width-specific names from generic versions. The three-level macro scheme is necessary to get the macros expanded when we want @@ -838,6 +845,7 @@ pcre2_compile are called by application code. */ #define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_) #define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_) #define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_) +#define pcre2_get_match_data_size PCRE2_SUFFIX(pcre2_get_match_data_size_) #define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_) #define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_) #define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_) @@ -848,6 +856,7 @@ pcre2_compile are called by application code. */ #define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_) #define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_) #define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_) +#define pcre2_maketables_free PCRE2_SUFFIX(pcre2_maketables_free_) #define pcre2_match PCRE2_SUFFIX(pcre2_match_) #define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_) #define pcre2_match_context_create PCRE2_SUFFIX(pcre2_match_context_create_) diff --git a/src/3rdparty/pcre2/src/pcre2_auto_possess.c b/src/3rdparty/pcre2/src/pcre2_auto_possess.c index 6d7b7c4a4d..5b95b9b8a8 100644 --- a/src/3rdparty/pcre2/src/pcre2_auto_possess.c +++ b/src/3rdparty/pcre2/src/pcre2_auto_possess.c @@ -624,6 +624,13 @@ for(;;) case OP_ASSERTBACK_NOT: case OP_ONCE: return !entered_a_group; + + /* Non-atomic assertions - don't possessify last iterator. This needs + more thought. */ + + case OP_ASSERT_NA: + case OP_ASSERTBACK_NA: + return FALSE; } /* Skip over the bracket and inspect what comes next. */ diff --git a/src/3rdparty/pcre2/src/pcre2_compile.c b/src/3rdparty/pcre2/src/pcre2_compile.c index 068735ae8e..f2e6b6b5bd 100644 --- a/src/3rdparty/pcre2/src/pcre2_compile.c +++ b/src/3rdparty/pcre2/src/pcre2_compile.c @@ -135,6 +135,9 @@ static BOOL set_lookbehind_lengths(uint32_t **, int *, int *, parsed_recurse_check *, compile_block *); +static int + check_lookbehinds(uint32_t *, uint32_t **, parsed_recurse_check *, + compile_block *); /************************************************* @@ -250,36 +253,41 @@ is present where expected in a conditional group. */ #define META_LOOKBEHIND 0x80250000u /* (?<= */ #define META_LOOKBEHINDNOT 0x80260000u /* (? META_END. A macros encapsulates -the storing of literal values in the parsed pattern. */ +/* Only in 32-bit mode can there be literals > META_END. A macro encapsulates +the storing of literal values in the main parsed pattern, where they can always +be quantified. */ #if PCRE2_CODE_UNIT_WIDTH == 32 #define PARSED_LITERAL(c, p) \ @@ -2474,6 +2497,7 @@ uint32_t delimiter; uint32_t namelen; uint32_t class_range_state; uint32_t *verblengthptr = NULL; /* Value avoids compiler warning */ +uint32_t *verbstartptr = NULL; uint32_t *previous_callout = NULL; uint32_t *parsed_pattern = cb->parsed_pattern; uint32_t *parsed_pattern_end = cb->parsed_pattern_end; @@ -2600,10 +2624,20 @@ while (ptr < ptrend) errorcode = ERR28; goto FAILED; } - if (!inverbname && after_manual_callout-- <= 0) - parsed_pattern = manage_callouts(thisptr, &previous_callout, - auto_callout, parsed_pattern, cb); - PARSED_LITERAL(c, parsed_pattern); + if (inverbname) + { /* Don't use PARSED_LITERAL() because it */ +#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */ + if (c >= META_END) *parsed_pattern++ = META_BIGVALUE; +#endif + *parsed_pattern++ = c; + } + else + { + if (after_manual_callout-- <= 0) + parsed_pattern = manage_callouts(thisptr, &previous_callout, + auto_callout, parsed_pattern, cb); + PARSED_LITERAL(c, parsed_pattern); + } meta_quantifier = 0; } continue; /* Next character */ @@ -2640,13 +2674,15 @@ while (ptr < ptrend) switch(c) { - default: - PARSED_LITERAL(c, parsed_pattern); + default: /* Don't use PARSED_LITERAL() because it */ +#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */ + if (c >= META_END) *parsed_pattern++ = META_BIGVALUE; +#endif + *parsed_pattern++ = c; break; case CHAR_RIGHT_PARENTHESIS: inverbname = FALSE; - okquantifier = FALSE; /* Was probably set by literals */ /* This is the length in characters */ verbnamelength = (PCRE2_SIZE)(parsed_pattern - verblengthptr - 1); /* But the limit on the length is in code units */ @@ -2680,8 +2716,11 @@ while (ptr < ptrend) switch(escape) { - case 0: - PARSED_LITERAL(c, parsed_pattern); + case 0: /* Don't use PARSED_LITERAL() because it */ +#if PCRE2_CODE_UNIT_WIDTH == 32 /* sets okquantifier. */ + if (c >= META_END) *parsed_pattern++ = META_BIGVALUE; +#endif + *parsed_pattern++ = c; break; case ESC_Q: @@ -3135,6 +3174,21 @@ while (ptr < ptrend) goto FAILED_BACK; } + /* Most (*VERB)s are not allowed to be quantified, but an ungreedy + quantifier can be useful for (*ACCEPT) - meaning "succeed on backtrack", a + sort of negated (*COMMIT). We therefore allow (*ACCEPT) to be quantified by + wrapping it in non-capturing brackets, but we have to allow for a preceding + (*MARK) for when (*ACCEPT) has an argument. */ + + if (parsed_pattern[-1] == META_ACCEPT) + { + uint32_t *p; + for (p = parsed_pattern - 1; p >= verbstartptr; p--) p[1] = p[0]; + *verbstartptr = META_NOCAPTURE; + parsed_pattern[1] = META_KET; + parsed_pattern += 2; + } + /* Now we can put the quantifier into the parsed pattern vector. At this stage, we have only the basic quantifier. The check for a following + or ? modifier happens at the top of the loop, after any intervening comments @@ -3581,6 +3635,8 @@ while (ptr < ptrend) if (c == CHAR_RIGHT_SQUARE_BRACKET && !inescq) break; } /* End of class-processing loop */ + /* -] at the end of a class is a literal '-' */ + if (class_range_state == RANGE_STARTED) { parsed_pattern[-1] = CHAR_MINUS; @@ -3611,6 +3667,11 @@ while (ptr < ptrend) nest_depth++; if ((options & PCRE2_NO_AUTO_CAPTURE) == 0) { + if (cb->bracount >= MAX_GROUP_NUMBER) + { + errorcode = ERR97; + goto FAILED; + } cb->bracount++; *parsed_pattern++ = META_CAPTURE | cb->bracount; } @@ -3658,19 +3719,20 @@ while (ptr < ptrend) goto FAILED; } - /* Check for expecting an assertion condition. If so, only lookaround - assertions are valid. */ + /* Check for expecting an assertion condition. If so, only atomic + lookaround assertions are valid. */ meta = alasmeta[i].meta; if (prev_expect_cond_assert > 0 && (meta < META_LOOKAHEAD || meta > META_LOOKBEHINDNOT)) { - errorcode = ERR28; /* Assertion expected */ + errorcode = (meta == META_LOOKAHEAD_NA || meta == META_LOOKBEHIND_NA)? + ERR98 : ERR28; /* (Atomic) assertion expected */ goto FAILED; } - /* The lookaround alphabetic synonyms can be almost entirely handled by - jumping to the code that handles the traditional symbolic forms. */ + /* The lookaround alphabetic synonyms can mostly be handled by jumping + to the code that handles the traditional symbolic forms. */ switch(meta) { @@ -3684,11 +3746,17 @@ while (ptr < ptrend) case META_LOOKAHEAD: goto POSITIVE_LOOK_AHEAD; + case META_LOOKAHEAD_NA: + *parsed_pattern++ = meta; + ptr++; + goto POST_ASSERTION; + case META_LOOKAHEADNOT: goto NEGATIVE_LOOK_AHEAD; case META_LOOKBEHIND: case META_LOOKBEHINDNOT: + case META_LOOKBEHIND_NA: *parsed_pattern++ = meta; ptr--; goto POST_LOOKBEHIND; @@ -3770,6 +3838,12 @@ while (ptr < ptrend) goto FAILED; } + /* Remember where this verb, possibly with a preceding (*MARK), starts, + for handling quantified (*ACCEPT). */ + + verbstartptr = parsed_pattern; + okquantifier = (verbs[i].meta == META_ACCEPT); + /* It appears that Perl allows any characters whatsoever, other than a closing parenthesis, to appear in arguments ("names"), so we no longer insist on letters, digits, and underscores. Perl does not, however, do @@ -4386,7 +4460,7 @@ while (ptr < ptrend) *parsed_pattern++ = (ptr[1] == CHAR_EQUALS_SIGN)? META_LOOKBEHIND : META_LOOKBEHINDNOT; - POST_LOOKBEHIND: /* Come from (*plb: and (*nlb: */ + POST_LOOKBEHIND: /* Come from (*plb: (*naplb: and (*nlb: */ *has_lookbehind = TRUE; offset = (PCRE2_SIZE)(ptr - cb->start_pattern - 2); PUTOFFSET(offset, parsed_pattern); @@ -4435,6 +4509,11 @@ while (ptr < ptrend) /* We have a name for this capturing group. It is also assigned a number, which is its primary means of identification. */ + if (cb->bracount >= MAX_GROUP_NUMBER) + { + errorcode = ERR97; + goto FAILED; + } cb->bracount++; *parsed_pattern++ = META_CAPTURE | cb->bracount; nest_depth++; @@ -4661,6 +4740,7 @@ for (;;) case OP_ASSERT_NOT: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: + case OP_ASSERTBACK_NA: if (!skipassert) return code; do code += GET(code, 1); while (*code == OP_ALT); code += PRIV(OP_lengths)[*code]; @@ -5221,8 +5301,10 @@ PCRE2_UCHAR *tempcode; PCRE2_UCHAR *previous = NULL; PCRE2_UCHAR op_previous; BOOL groupsetfirstcu = FALSE; +BOOL had_accept = FALSE; BOOL matched_char = FALSE; BOOL previous_matched_char = FALSE; +BOOL reset_caseful = FALSE; const uint8_t *cbits = cb->cbits; uint8_t classbits[32]; @@ -5355,7 +5437,7 @@ for (;; pptr++) if (meta < META_ASTERISK || meta > META_MINMAX_QUERY) { previous = code; - if (matched_char) okreturn = 1; + if (matched_char && !had_accept) okreturn = 1; } previous_matched_char = matched_char; @@ -5499,7 +5581,45 @@ for (;; pptr++) } /* End of 1-char optimization */ /* Handle character classes that contain more than just one literal - character. */ + character. If there are exactly two characters in a positive class, see if + they are case partners. This can be optimized to generate a caseless single + character match (which also sets first/required code units if relevant). */ + + if (meta == META_CLASS && pptr[1] < META_END && pptr[2] < META_END && + pptr[3] == META_CLASS_END) + { + uint32_t c = pptr[1]; + +#ifdef SUPPORT_UNICODE + if (UCD_CASESET(c) == 0) +#endif + { + uint32_t d; + +#ifdef SUPPORT_UNICODE + if (utf && c > 127) d = UCD_OTHERCASE(c); else +#endif + { +#if PCRE2_CODE_UNIT_WIDTH != 8 + if (c > 255) d = c; else +#endif + d = TABLE_GET(c, cb->fcc, c); + } + + if (c != d && pptr[2] == d) + { + pptr += 3; /* Move on to class end */ + meta = c; + if ((options & PCRE2_CASELESS) == 0) + { + reset_caseful = TRUE; + options |= PCRE2_CASELESS; + req_caseopt = REQ_CASELESS; + } + goto CLASS_CASELESS_CHAR; + } + } + } /* If a non-extended class contains a negative special such as \S, we need to flip the negation flag at the end, so that support for characters > 255 @@ -5994,7 +6114,7 @@ for (;; pptr++) workspace overflow. Do not set firstcu after *ACCEPT. */ case META_ACCEPT: - cb->had_accept = TRUE; + cb->had_accept = had_accept = TRUE; for (oc = cb->open_caps; oc != NULL && oc->assert_depth >= cb->assert_depth; oc = oc->next) @@ -6252,6 +6372,11 @@ for (;; pptr++) cb->assert_depth += 1; goto GROUP_PROCESS; + case META_LOOKAHEAD_NA: + bravalue = OP_ASSERT_NA; + cb->assert_depth += 1; + goto GROUP_PROCESS; + /* Optimize (?!) to (*FAIL) unless it is quantified - which is a weird thing to do, but Perl allows all assertions to be quantified, and when they contain capturing parentheses there may be a potential use for @@ -6283,6 +6408,11 @@ for (;; pptr++) cb->assert_depth += 1; goto GROUP_PROCESS; + case META_LOOKBEHIND_NA: + bravalue = OP_ASSERTBACK_NA; + cb->assert_depth += 1; + goto GROUP_PROCESS; + case META_ATOMIC: bravalue = OP_ONCE; goto GROUP_PROCESS_NOTE_EMPTY; @@ -6341,7 +6471,7 @@ for (;; pptr++) /* If we've just compiled an assertion, pop the assert depth. */ - if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NOT) + if (bravalue >= OP_ASSERT && bravalue <= OP_ASSERTBACK_NA) cb->assert_depth -= 1; /* At the end of compiling, code is still pointing to the start of the @@ -6491,8 +6621,8 @@ for (;; pptr++) we must only take the reqcu when the group also set a firstcu. Otherwise, in that example, 'X' ends up set for both. */ - else if (bravalue == OP_ASSERT && subreqcuflags >= 0 && - subfirstcuflags >= 0) + else if ((bravalue == OP_ASSERT || bravalue == OP_ASSERT_NA) && + subreqcuflags >= 0 && subfirstcuflags >= 0) { reqcu = subreqcu; reqcuflags = subreqcuflags; @@ -6713,10 +6843,6 @@ for (;; pptr++) reqvary = (repeat_min == repeat_max)? 0 : REQ_VARY; op_type = 0; - /* If the repeat is {1} we can ignore it. */ - - if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT; - /* Adjust first and required code units for a zero repeat. */ if (repeat_min == 0) @@ -6759,7 +6885,10 @@ for (;; pptr++) tempcode = previous; op_previous = *previous; - /* Now handle repetition for the different types of item. */ + /* Now handle repetition for the different types of item. If the repeat + minimum and the repeat maximum are both 1, we can ignore the quantifier for + non-parenthesized items, as they have only one alternative. For anything in + parentheses, we must not ignore if {1} is possessive. */ switch (op_previous) { @@ -6773,6 +6902,7 @@ for (;; pptr++) case OP_CHARI: case OP_NOT: case OP_NOTI: + if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT; op_type = chartypeoffset[op_previous - OP_CHAR]; /* Deal with UTF characters that take up more than one code unit. */ @@ -6819,6 +6949,7 @@ for (;; pptr++) code = previous; goto END_REPEAT; } + if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT; if (repeat_min == 0 && repeat_max == REPEAT_UNLIMITED) *code++ = OP_CRSTAR + repeat_type; @@ -6853,6 +6984,8 @@ for (;; pptr++) repetition. */ case OP_RECURSE: + if (repeat_max == 1 && repeat_min == 1 && !possessive_quantifier) + goto END_REPEAT; /* Generate unwrapped repeats for a non-zero minimum, except when the minimum is 1 and the maximum unlimited, because that can be handled with @@ -6923,8 +7056,10 @@ for (;; pptr++) case OP_ASSERT: case OP_ASSERT_NOT: + case OP_ASSERT_NA: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: + case OP_ASSERTBACK_NA: case OP_ONCE: case OP_SCRIPT_RUN: case OP_BRA: @@ -6935,6 +7070,9 @@ for (;; pptr++) PCRE2_UCHAR *bralink = NULL; PCRE2_UCHAR *brazeroptr = NULL; + if (repeat_max == 1 && repeat_min == 1 && !possessive_quantifier) + goto END_REPEAT; + /* Repeating a DEFINE group (or any group where the condition is always FALSE and there is only one branch) is pointless, but Perl allows the syntax, so we just ignore the repeat. */ @@ -7151,11 +7289,12 @@ for (;; pptr++) and SCRIPT_RUN groups at runtime, but in a different way.] Then, if the quantifier was possessive and the bracket is not a - conditional, we convert the BRA code to the POS form, and the KET code to - KETRPOS. (It turns out to be convenient at runtime to detect this kind of - subpattern at both the start and at the end.) The use of special opcodes - makes it possible to reduce greatly the stack usage in pcre2_match(). If - the group is preceded by OP_BRAZERO, convert this to OP_BRAPOSZERO. + conditional, we convert the BRA code to the POS form, and the KET code + to KETRPOS. (It turns out to be convenient at runtime to detect this + kind of subpattern at both the start and at the end.) The use of + special opcodes makes it possible to reduce greatly the stack usage in + pcre2_match(). If the group is preceded by OP_BRAZERO, convert this to + OP_BRAPOSZERO. Then, if the minimum number of matches is 1 or 0, cancel the possessive flag so that the default action below, of wrapping everything inside @@ -7256,6 +7395,8 @@ for (;; pptr++) int prop_type, prop_value; PCRE2_UCHAR *oldcode; + if (repeat_max == 1 && repeat_min == 1) goto END_REPEAT; + op_type = OP_TYPESTAR - OP_STAR; /* Use type opcodes */ mclength = 0; /* Not a character */ @@ -7718,9 +7859,15 @@ for (;; pptr++) } #endif - /* Caseful matches, or not one of the multicase characters. Get the - character's code units into mcbuffer, with the length in mclength. When not - in UTF mode, the length is always 1. */ + /* Caseful matches, or caseless and not one of the multicase characters. We + come here by goto in the case of a positive class that contains only + case-partners of a character with just two cases; matched_char has already + been set TRUE and options fudged if necessary. */ + + CLASS_CASELESS_CHAR: + + /* Get the character's code units into mcbuffer, with the length in + mclength. When not in UTF mode, the length is always 1. */ #ifdef SUPPORT_UNICODE if (utf) mclength = PRIV(ord2utf)(meta, mcbuffer); else @@ -7752,8 +7899,9 @@ for (;; pptr++) zeroreqcu = reqcu; zeroreqcuflags = reqcuflags; - /* If the character is more than one code unit long, we can set firstcu - only if it is not to be matched caselessly. */ + /* If the character is more than one code unit long, we can set a single + firstcu only if it is not to be matched caselessly. Multiple possible + starting code units may be picked up later in the studying code. */ if (mclength == 1 || req_caseopt == 0) { @@ -7783,7 +7931,17 @@ for (;; pptr++) reqcuflags = req_caseopt | cb->req_varyopt; } } - break; /* End default meta handling */ + + /* If caselessness was temporarily instated, reset it. */ + + if (reset_caseful) + { + options &= ~PCRE2_CASELESS; + req_caseopt = 0; + reset_caseful = FALSE; + } + + break; /* End literal character handling */ } /* End of big switch */ } /* End of big loop */ @@ -7874,7 +8032,10 @@ length = 2 + 2*LINK_SIZE + skipunits; /* Remember if this is a lookbehind assertion, and if it is, save its length and skip over the pattern offset. */ -lookbehind = *code == OP_ASSERTBACK || *code == OP_ASSERTBACK_NOT; +lookbehind = *code == OP_ASSERTBACK || + *code == OP_ASSERTBACK_NOT || + *code == OP_ASSERTBACK_NA; + if (lookbehind) { lookbehindlength = META_DATA(pptr[-1]); @@ -7948,7 +8109,7 @@ for (;;) /* If this is not the first branch, the first char and reqcu have to match the values from all the previous branches, except that if the previous value for reqcu didn't have REQ_VARY set, it can still match, - and we set REQ_VARY for the regex. */ + and we set REQ_VARY for the group from this branch's value. */ else { @@ -7987,7 +8148,7 @@ for (;;) else { reqcu = branchreqcu; - reqcuflags |= branchreqcuflags; /* To "or" REQ_VARY */ + reqcuflags |= branchreqcuflags; /* To "or" REQ_VARY if present */ } } } @@ -8167,7 +8328,7 @@ do { /* Positive forward assertion */ - else if (op == OP_ASSERT) + else if (op == OP_ASSERT || op == OP_ASSERT_NA) { if (!is_anchored(scode, bracket_map, cb, atomcount, TRUE)) return FALSE; } @@ -8305,7 +8466,7 @@ do { /* Positive forward assertions */ - else if (op == OP_ASSERT) + else if (op == OP_ASSERT || op == OP_ASSERT_NA) { if (!is_startline(scode, bracket_map, cb, atomcount, TRUE)) return FALSE; @@ -8547,9 +8708,11 @@ do { case OP_CBRAPOS: case OP_SCBRAPOS: case OP_ASSERT: + case OP_ASSERT_NA: case OP_ONCE: case OP_SCRIPT_RUN: - d = find_firstassertedcu(scode, &dflags, inassert + ((op==OP_ASSERT)?1:0)); + d = find_firstassertedcu(scode, &dflags, inassert + + ((op == OP_ASSERT || op == OP_ASSERT_NA)?1:0)); if (dflags < 0) return 0; if (cflags < 0) { c = d; cflags = dflags; } @@ -8578,6 +8741,19 @@ do { case OP_MINPLUSI: case OP_POSPLUSI: if (inassert == 0) return 0; + + /* If the character is more than one code unit long, we cannot set its + first code unit when matching caselessly. Later scanning may pick up + multiple code units. */ + +#ifdef SUPPORT_UNICODE +#if PCRE2_CODE_UNIT_WIDTH == 8 + if (scode[1] >= 0x80) return 0; +#elif PCRE2_CODE_UNIT_WIDTH == 16 + if (scode[1] >= 0xd800 && scode[1] <= 0xdfff) return 0; +#endif +#endif + if (cflags < 0) { c = scode[1]; cflags = REQ_CASELESS; } else if (c != scode[1]) return 0; break; @@ -8745,8 +8921,10 @@ for (;; pptr++) case META_COND_VERSION: case META_LOOKAHEAD: case META_LOOKAHEADNOT: + case META_LOOKAHEAD_NA: case META_LOOKBEHIND: case META_LOOKBEHINDNOT: + case META_LOOKBEHIND_NA: case META_NOCAPTURE: case META_SCRIPT_RUN: nestlevel++; @@ -8798,7 +8976,7 @@ Returns: the group length or a negative number static int get_grouplength(uint32_t **pptrptr, BOOL isinline, int *errcodeptr, int *lcptr, - int group, parsed_recurse_check *recurses, compile_block *cb) + int group, parsed_recurse_check *recurses, compile_block *cb) { int branchlength; int grouplength = -1; @@ -8847,8 +9025,7 @@ return -1; *************************************************/ /* Return a fixed length for a branch in a lookbehind, giving an error if the -length is not fixed. If any lookbehinds are encountered on the way, they get -their length set. On entry, *pptrptr points to the first element inside the +length is not fixed. On entry, *pptrptr points to the first element inside the branch. On exit it is set to point to the ALT or KET. Arguments: @@ -8978,15 +9155,16 @@ for (;; pptr++) } break; - /* Lookaheads can be ignored, but we must start the skip inside the group - so that it isn't treated as a group within the branch. */ + /* Lookaheads do not contribute to the length of this branch, but they may + contain lookbehinds within them whose lengths need to be set. */ case META_LOOKAHEAD: case META_LOOKAHEADNOT: - pptr = parsed_skip(pptr + 1, PSKIP_KET); - if (pptr == NULL) goto PARSED_SKIP_FAILED; + case META_LOOKAHEAD_NA: + *errcodeptr = check_lookbehinds(pptr + 1, &pptr, recurses, cb); + if (*errcodeptr != 0) return -1; - /* Also ignore any qualifiers that follow a lookahead assertion. */ + /* Ignore any qualifiers that follow a lookahead assertion. */ switch (pptr[1]) { @@ -9013,10 +9191,12 @@ for (;; pptr++) } break; - /* Lookbehinds can be ignored, but must themselves be checked. */ + /* A nested lookbehind does not contribute any length to this lookbehind, + but must itself be checked and have its lengths set. */ case META_LOOKBEHIND: case META_LOOKBEHINDNOT: + case META_LOOKBEHIND_NA: if (!set_lookbehind_lengths(&pptr, errcodeptr, lcptr, recurses, cb)) return -1; break; @@ -9178,8 +9358,26 @@ for (;; pptr++) case META_MINMAX_QUERY: if (pptr[1] == pptr[2]) { - if (pptr[1] == 0) branchlength -= lastitemlength; - else itemlength = (pptr[1] - 1) * lastitemlength; + switch(pptr[1]) + { + case 0: + branchlength -= lastitemlength; + break; + + case 1: + itemlength = 0; + break; + + default: /* Check for integer overflow */ + if (lastitemlength != 0 && /* Should not occur, but just in case */ + INT_MAX/lastitemlength < pptr[1] - 1) + { + *errcodeptr = ERR87; /* Integer overflow; lookbehind too big */ + return -1; + } + itemlength = (pptr[1] - 1) * lastitemlength; + break; + } pptr += 2; break; } @@ -9193,24 +9391,23 @@ for (;; pptr++) return -1; } - /* Add the item length to the branchlength, and save it for use if the next - thing is a quantifier. */ - - branchlength += itemlength; - lastitemlength = itemlength; - - /* Ensure that the length does not overflow the limit. */ + /* Add the item length to the branchlength, checking for integer overflow and + for the branch length exceeding the limit. */ - if (branchlength > LOOKBEHIND_MAX) + if (INT_MAX - branchlength < (int)itemlength || + (branchlength += itemlength) > LOOKBEHIND_MAX) { *errcodeptr = ERR87; return -1; } + + /* Save this item length for use if the next item is a quantifier. */ + + lastitemlength = itemlength; } EXIT: *pptrptr = pptr; -if (branchlength > cb->max_lookbehind) cb->max_lookbehind = branchlength; return branchlength; PARSED_SKIP_FAILED: @@ -9229,6 +9426,11 @@ branches. An error occurs if any branch does not have a fixed length that is less than the maximum (65535). On exit, the pointer must be left on the final ket. +The function also maintains the max_lookbehind value. Any lookbehind branch +that contains a nested lookbehind may actually look further back than the +length of the branch. The additional amount is passed back from +get_branchlength() as an "extra" value. + Arguments: pptrptr pointer to pointer in the parsed pattern errcodeptr pointer to error code @@ -9262,6 +9464,7 @@ do if (cb->erroroffset == PCRE2_UNSET) cb->erroroffset = offset; return FALSE; } + if (branchlength > cb->max_lookbehind) cb->max_lookbehind = branchlength; *bptr |= branchlength; /* branchlength never more than 65535 */ bptr = *pptrptr; } @@ -9282,20 +9485,30 @@ set_lookbehind_lengths() for each one. At the start, the errorcode is zero and the error offset is marked unset. The enables the functions above not to override settings from deeper nestings. -Arguments cb points to the compile block -Returns: 0 on success, or an errorcode (cb->erroroffset will be set) +This function is called recursively from get_branchlength() for lookaheads in +order to process any lookbehinds that they may contain. It stops when it hits a +non-nested closing parenthesis in this case, returning a pointer to it. + +Arguments + pptr points to where to start (start of pattern or start of lookahead) + retptr if not NULL, return the ket pointer here + recurses chain of recurse_check to catch mutual recursion + cb points to the compile block + +Returns: 0 on success, or an errorcode (cb->erroroffset will be set) */ static int -check_lookbehinds(compile_block *cb) +check_lookbehinds(uint32_t *pptr, uint32_t **retptr, + parsed_recurse_check *recurses, compile_block *cb) { -uint32_t *pptr; int errorcode = 0; int loopcount = 0; +int nestlevel = 0; cb->erroroffset = PCRE2_UNSET; -for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) +for (; *pptr != META_END; pptr++) { if (*pptr < META_END) continue; /* Literal */ @@ -9309,14 +9522,31 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) pptr += 1; break; + case META_KET: + if (--nestlevel < 0) + { + if (retptr != NULL) *retptr = pptr; + return 0; + } + break; + + case META_ATOMIC: + case META_CAPTURE: + case META_COND_ASSERT: + case META_LOOKAHEAD: + case META_LOOKAHEADNOT: + case META_LOOKAHEAD_NA: + case META_NOCAPTURE: + case META_SCRIPT_RUN: + nestlevel++; + break; + case META_ACCEPT: case META_ALT: case META_ASTERISK: case META_ASTERISK_PLUS: case META_ASTERISK_QUERY: - case META_ATOMIC: case META_BACKREF: - case META_CAPTURE: case META_CIRCUMFLEX: case META_CLASS: case META_CLASS_EMPTY: @@ -9324,14 +9554,9 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) case META_CLASS_END: case META_CLASS_NOT: case META_COMMIT: - case META_COND_ASSERT: case META_DOLLAR: case META_DOT: case META_FAIL: - case META_KET: - case META_LOOKAHEAD: - case META_LOOKAHEADNOT: - case META_NOCAPTURE: case META_PLUS: case META_PLUS_PLUS: case META_PLUS_QUERY: @@ -9341,7 +9566,6 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) case META_QUERY_QUERY: case META_RANGE_ESCAPED: case META_RANGE_LITERAL: - case META_SCRIPT_RUN: case META_SKIP: case META_THEN: break; @@ -9351,13 +9575,22 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) break; case META_BACKREF_BYNAME: + case META_RECURSE_BYNAME: + pptr += 1 + SIZEOFFSET; + break; + case META_COND_DEFINE: case META_COND_NAME: case META_COND_NUMBER: case META_COND_RNAME: case META_COND_RNUMBER: - case META_RECURSE_BYNAME: pptr += 1 + SIZEOFFSET; + nestlevel++; + break; + + case META_COND_VERSION: + pptr += 3; + nestlevel++; break; case META_CALLOUT_STRING: @@ -9378,7 +9611,6 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) break; case META_CALLOUT_NUMBER: - case META_COND_VERSION: pptr += 3; break; @@ -9392,7 +9624,8 @@ for (pptr = cb->parsed_pattern; *pptr != META_END; pptr++) case META_LOOKBEHIND: case META_LOOKBEHINDNOT: - if (!set_lookbehind_lengths(&pptr, &errorcode, &loopcount, NULL, cb)) + case META_LOOKBEHIND_NA: + if (!set_lookbehind_lengths(&pptr, &errorcode, &loopcount, recurses, cb)) return errorcode; break; } @@ -9494,6 +9727,10 @@ if (pattern == NULL) if (ccontext == NULL) ccontext = (pcre2_compile_context *)(&PRIV(default_compile_context)); +/* PCRE2_MATCH_INVALID_UTF implies UTF */ + +if ((options & PCRE2_MATCH_INVALID_UTF) != 0) options |= PCRE2_UTF; + /* Check that all undefined public option bits are zero. */ if ((options & ~PUBLIC_COMPILE_OPTIONS) != 0 || @@ -9672,7 +9909,7 @@ if ((options & PCRE2_LITERAL) == 0) ptr += skipatstart; -/* Can't support UTF or UCP unless PCRE2 has been compiled with UTF support. */ +/* Can't support UTF or UCP if PCRE2 was built without Unicode support. */ #ifndef SUPPORT_UNICODE if ((cb.external_options & (PCRE2_UTF|PCRE2_UCP)) != 0) @@ -9842,7 +10079,7 @@ lengths. */ if (has_lookbehind) { - errorcode = check_lookbehinds(&cb); + errorcode = check_lookbehinds(cb.parsed_pattern, NULL, NULL, &cb); if (errorcode != 0) goto HAD_CB_ERROR; } @@ -9990,8 +10227,9 @@ re->max_lookbehind = cb.max_lookbehind; if (cb.had_accept) { - reqcu = 0; /* Must disable after (*ACCEPT) */ + reqcu = 0; /* Must disable after (*ACCEPT) */ reqcuflags = REQ_NONE; + re->flags |= PCRE2_HASACCEPT; /* Disables minimum length */ } /* Fill in the final opcode and check for disastrous overflow. If no overflow, @@ -10112,6 +10350,8 @@ unit. */ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0) { + int minminlength = 0; /* For minimal minlength from first/required CU */ + /* If we do not have a first code unit, see if there is one that is asserted (these are not saved during the compile because they can cause conflicts with actual literals that follow). */ @@ -10119,12 +10359,14 @@ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0) if (firstcuflags < 0) firstcu = find_firstassertedcu(codestart, &firstcuflags, 0); - /* Save the data for a first code unit. */ + /* Save the data for a first code unit. The existence of one means the + minimum length must be at least 1. */ if (firstcuflags >= 0) { re->first_codeunit = firstcu; re->flags |= PCRE2_FIRSTSET; + minminlength++; /* Handle caseless first code units. */ @@ -10158,39 +10400,72 @@ if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0) is_startline(codestart, 0, &cb, 0, FALSE)) re->flags |= PCRE2_STARTLINE; - /* Handle the "required code unit", if one is set. In the case of an anchored - pattern, do this only if it follows a variable length item in the pattern. */ + /* Handle the "required code unit", if one is set. In the UTF case we can + increment the minimum minimum length only if we are sure this really is a + different character and not a non-starting code unit of the first character, + because the minimum length count is in characters, not code units. */ - if (reqcuflags >= 0 && - ((re->overall_options & PCRE2_ANCHORED) == 0 || - (reqcuflags & REQ_VARY) != 0)) + if (reqcuflags >= 0) { - re->last_codeunit = reqcu; - re->flags |= PCRE2_LASTSET; +#if PCRE2_CODE_UNIT_WIDTH == 16 + if ((re->overall_options & PCRE2_UTF) == 0 || /* Not UTF */ + firstcuflags < 0 || /* First not set */ + (firstcu & 0xf800) != 0xd800 || /* First not surrogate */ + (reqcu & 0xfc00) != 0xdc00) /* Req not low surrogate */ +#elif PCRE2_CODE_UNIT_WIDTH == 8 + if ((re->overall_options & PCRE2_UTF) == 0 || /* Not UTF */ + firstcuflags < 0 || /* First not set */ + (firstcu & 0x80) == 0 || /* First is ASCII */ + (reqcu & 0x80) == 0) /* Req is ASCII */ +#endif + { + minminlength++; + } - /* Handle caseless required code units as for first code units (above). */ + /* In the case of an anchored pattern, set up the value only if it follows + a variable length item in the pattern. */ - if ((reqcuflags & REQ_CASELESS) != 0) + if ((re->overall_options & PCRE2_ANCHORED) == 0 || + (reqcuflags & REQ_VARY) != 0) { - if (reqcu < 128 || (!utf && reqcu < 255)) + re->last_codeunit = reqcu; + re->flags |= PCRE2_LASTSET; + + /* Handle caseless required code units as for first code units (above). */ + + if ((reqcuflags & REQ_CASELESS) != 0) { - if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS; - } + if (reqcu < 128 || (!utf && reqcu < 255)) + { + if (cb.fcc[reqcu] != reqcu) re->flags |= PCRE2_LASTCASELESS; + } #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8 - else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu) - re->flags |= PCRE2_LASTCASELESS; + else if (reqcu <= MAX_UTF_CODE_POINT && UCD_OTHERCASE(reqcu) != reqcu) + re->flags |= PCRE2_LASTCASELESS; #endif + } } } - /* Finally, study the compiled pattern to set up information such as a bitmap - of starting code units and a minimum matching length. */ + /* Study the compiled pattern to set up information such as a bitmap of + starting code units and a minimum matching length. */ if (PRIV(study)(re) != 0) { errorcode = ERR31; goto HAD_CB_ERROR; } + + /* If study() set a bitmap of starting code units, it implies a minimum + length of at least one. */ + + if ((re->flags & PCRE2_FIRSTMAPSET) != 0 && minminlength == 0) + minminlength = 1; + + /* If the minimum length set (or not set) by study() is less than the minimum + implied by required code units, override it. */ + + if (re->minlength < minminlength) re->minlength = minminlength; } /* End of start-of-match optimizations. */ /* Control ends up here in all cases. When running under valgrind, make a diff --git a/src/3rdparty/pcre2/src/pcre2_context.c b/src/3rdparty/pcre2/src/pcre2_context.c index 9c2886a6d0..f904a494a0 100644 --- a/src/3rdparty/pcre2/src/pcre2_context.c +++ b/src/3rdparty/pcre2/src/pcre2_context.c @@ -323,7 +323,7 @@ data. */ PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_set_character_tables(pcre2_compile_context *ccontext, - const unsigned char *tables) + const uint8_t *tables) { ccontext->tables = tables; return 0; diff --git a/src/3rdparty/pcre2/src/pcre2_dfa_match.c b/src/3rdparty/pcre2/src/pcre2_dfa_match.c index bbf3e21064..7d8ffe8a3e 100644 --- a/src/3rdparty/pcre2/src/pcre2_dfa_match.c +++ b/src/3rdparty/pcre2/src/pcre2_dfa_match.c @@ -173,6 +173,8 @@ static const uint8_t coptable[] = { 0, /* Assert not */ 0, /* Assert behind */ 0, /* Assert behind not */ + 0, /* NA assert */ + 0, /* NA assert behind */ 0, /* ONCE */ 0, /* SCRIPT_RUN */ 0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */ @@ -248,6 +250,8 @@ static const uint8_t poptable[] = { 0, /* Assert not */ 0, /* Assert behind */ 0, /* Assert behind not */ + 0, /* NA assert */ + 0, /* NA assert behind */ 0, /* ONCE */ 0, /* SCRIPT_RUN */ 0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */ @@ -962,7 +966,7 @@ for (;;) if (ptr >= end_subject) { if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0) - could_continue = TRUE; + return PCRE2_ERROR_PARTIAL; else { ADD_ACTIVE(state_offset + 1, 0); } } break; @@ -1011,10 +1015,12 @@ for (;;) /*-----------------------------------------------------------------*/ case OP_EODN: - if (clen == 0 && (mb->moptions & PCRE2_PARTIAL_HARD) != 0) - could_continue = TRUE; - else if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen)) - { ADD_ACTIVE(state_offset + 1, 0); } + if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen)) + { + if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0) + return PCRE2_ERROR_PARTIAL; + ADD_ACTIVE(state_offset + 1, 0); + } break; /*-----------------------------------------------------------------*/ @@ -3152,8 +3158,8 @@ for (;;) /* We have finished the processing at the current subject character. If no new states have been set for the next character, we have found all the - matches that we are going to find. If we are at the top level and partial - matching has been requested, check for appropriate conditions. + matches that we are going to find. If partial matching has been requested, + check for appropriate conditions. The "forced_ fail" variable counts the number of (*F) encountered for the character. If it is equal to the original active_count (saved in @@ -3165,22 +3171,24 @@ for (;;) if (new_count <= 0) { - if (rlevel == 1 && /* Top level, and */ - could_continue && /* Some could go on, and */ + if (could_continue && /* Some could go on, and */ forced_fail != workspace[1] && /* Not all forced fail & */ ( /* either... */ (mb->moptions & PCRE2_PARTIAL_HARD) != 0 /* Hard partial */ || /* or... */ ((mb->moptions & PCRE2_PARTIAL_SOFT) != 0 && /* Soft partial and */ - match_count < 0) /* no matches */ + match_count < 0) /* no matches */ ) && /* And... */ ( - partial_newline || /* Either partial NL */ - ( /* or ... */ - ptr >= end_subject && /* End of subject and */ - ptr > mb->start_used_ptr) /* Inspected non-empty string */ + partial_newline || /* Either partial NL */ + ( /* or ... */ + ptr >= end_subject && /* End of subject and */ + ( /* either */ + ptr > mb->start_used_ptr || /* Inspected non-empty string */ + mb->allowemptypartial /* or pattern has lookbehind */ + ) /* or could match empty */ ) - ) + )) match_count = PCRE2_ERROR_PARTIAL; break; /* Exit from loop along the subject string */ } @@ -3246,6 +3254,11 @@ BOOL utf, anchored, startline, firstline; BOOL has_first_cu = FALSE; BOOL has_req_cu = FALSE; +#if PCRE2_CODE_UNIT_WIDTH == 8 +BOOL memchr_not_found_first_cu = FALSE; +BOOL memchr_not_found_first_cu2 = FALSE; +#endif + PCRE2_UCHAR first_cu = 0; PCRE2_UCHAR first_cu2 = 0; PCRE2_UCHAR req_cu = 0; @@ -3295,6 +3308,11 @@ if ((options & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) != 0 && ((re->overall_options | options) & PCRE2_ENDANCHORED) != 0) return PCRE2_ERROR_BADOPTION; +/* Invalid UTF support is not available for DFA matching. */ + +if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0) + return PCRE2_ERROR_DFA_UINVALID_UTF; + /* Check that the first field in the block is the magic number. If it is not, return with PCRE2_ERROR_BADMAGIC. */ @@ -3404,6 +3422,8 @@ mb->tables = re->tables; mb->start_subject = subject; mb->end_subject = end_subject; mb->start_offset = start_offset; +mb->allowemptypartial = (re->max_lookbehind > 0) || + (re->flags & PCRE2_MATCH_EMPTY) != 0; mb->moptions = options; mb->poptions = re->overall_options; mb->match_call_count = 0; @@ -3619,7 +3639,10 @@ for (;;) /* Not anchored. Advance to a unique first code unit if there is one. In 8-bit mode, the use of memchr() gives a big speed up, even though we have to call it twice in caseless mode, in order to find the earliest occurrence - of the character in either of its cases. */ + of the character in either of its cases. If a call to memchr() that + searches the rest of the subject fails to find one case, remember that in + order not to keep on repeating the search. This can make a huge difference + when the strings are very long and only one case is present. */ else { @@ -3633,11 +3656,29 @@ for (;;) (smc = UCHAR21TEST(start_match)) != first_cu && smc != first_cu2) start_match++; + #else /* 8-bit code units */ - PCRE2_SPTR pp1 = - memchr(start_match, first_cu, end_subject-start_match); - PCRE2_SPTR pp2 = - memchr(start_match, first_cu2, end_subject-start_match); + PCRE2_SPTR pp1 = NULL; + PCRE2_SPTR pp2 = NULL; + PCRE2_SIZE cu2size = end_subject - start_match; + + if (!memchr_not_found_first_cu) + { + pp1 = memchr(start_match, first_cu, end_subject - start_match); + if (pp1 == NULL) memchr_not_found_first_cu = TRUE; + else cu2size = pp1 - start_match; + } + + /* If pp1 is not NULL, we have arranged to search only as far as pp1, + to see if the other case is earlier, so we can set "not found" only + when both searches have returned NULL. */ + + if (!memchr_not_found_first_cu2) + { + pp2 = memchr(start_match, first_cu2, cu2size); + memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL); + } + if (pp1 == NULL) start_match = (pp2 == NULL)? end_subject : pp2; else @@ -3653,7 +3694,7 @@ for (;;) while (start_match < end_subject && UCHAR21TEST(start_match) != first_cu) start_match++; -#else +#else /* 8-bit code units */ start_match = memchr(start_match, first_cu, end_subject - start_match); if (start_match == NULL) start_match = end_subject; #endif @@ -3740,6 +3781,8 @@ for (;;) if ((mb->moptions & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) == 0) { + PCRE2_SPTR p; + /* The minimum matching length is a lower bound; no actual string of that length may actually match the pattern. Although the value is, strictly, in characters, we treat it as code units to avoid spending too much time @@ -3753,37 +3796,63 @@ for (;;) point. This optimization can save a huge amount of backtracking in patterns with nested unlimited repeats that aren't going to match. Writing separate code for cased/caseless versions makes it go faster, as - does using an autoincrement and backing off on a match. + does using an autoincrement and backing off on a match. As in the case of + the first code unit, using memchr() in the 8-bit library gives a big + speed up. Unlike the first_cu check above, we do not need to call + memchr() twice in the caseless case because we only need to check for the + presence of the character in either case, not find the first occurrence. + + The search can be skipped if the code unit was found later than the + current starting point in a previous iteration of the bumpalong loop. HOWEVER: when the subject string is very, very long, searching to its end can take a long time, and give bad performance on quite ordinary patterns. This showed up when somebody was matching something like /^\d+C/ on a 32-megabyte string... so we don't do this when the string is - sufficiently long. */ + sufficiently long, but it's worth searching a lot more for unanchored + patterns. */ - if (has_req_cu && end_subject - start_match < REQ_CU_MAX) + p = start_match + (has_first_cu? 1:0); + if (has_req_cu && p > req_cu_ptr) { - PCRE2_SPTR p = start_match + (has_first_cu? 1:0); - - /* We don't need to repeat the search if we haven't yet reached the - place we found it at last time. */ + PCRE2_SIZE check_length = end_subject - start_match; - if (p > req_cu_ptr) + if (check_length < REQ_CU_MAX || + (!anchored && check_length < REQ_CU_MAX * 1000)) { - if (req_cu != req_cu2) + if (req_cu != req_cu2) /* Caseless */ { +#if PCRE2_CODE_UNIT_WIDTH != 8 while (p < end_subject) { uint32_t pp = UCHAR21INCTEST(p); if (pp == req_cu || pp == req_cu2) { p--; break; } } +#else /* 8-bit code units */ + PCRE2_SPTR pp = p; + p = memchr(pp, req_cu, end_subject - pp); + if (p == NULL) + { + p = memchr(pp, req_cu2, end_subject - pp); + if (p == NULL) p = end_subject; + } +#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */ } + + /* The caseful case */ + else { +#if PCRE2_CODE_UNIT_WIDTH != 8 while (p < end_subject) { if (UCHAR21INCTEST(p) == req_cu) { p--; break; } } + +#else /* 8-bit code units */ + p = memchr(p, req_cu, end_subject - p); + if (p == NULL) p = end_subject; +#endif } /* If we can't find the required code unit, break the matching loop, diff --git a/src/3rdparty/pcre2/src/pcre2_error.c b/src/3rdparty/pcre2/src/pcre2_error.c index 1d02cf14a3..c61648cb7f 100644 --- a/src/3rdparty/pcre2/src/pcre2_error.c +++ b/src/3rdparty/pcre2/src/pcre2_error.c @@ -184,6 +184,8 @@ static const unsigned char compile_error_texts[] = /* 95 */ "(*alpha_assertion) not recognized\0" "script runs require Unicode support, which this version of PCRE2 does not have\0" + "too many capturing groups (maximum 65535)\0" + "atomic assertion expected after (?( or (?(?C)\0" ; /* Match-time and UTF error texts are in the same format. */ @@ -268,6 +270,7 @@ static const unsigned char match_error_texts[] = "invalid syntax\0" /* 65 */ "internal error - duplicate substitution match\0" + "PCRE2_MATCH_INVALID_UTF is not supported for DFA matching\0" ; diff --git a/src/3rdparty/pcre2/src/pcre2_internal.h b/src/3rdparty/pcre2/src/pcre2_internal.h index 814d91bddb..fe8ffe5c80 100644 --- a/src/3rdparty/pcre2/src/pcre2_internal.h +++ b/src/3rdparty/pcre2/src/pcre2_internal.h @@ -517,6 +517,7 @@ bytes in a code unit in that mode. */ #define PCRE2_HASBKPORX 0x00100000 /* contains \P, \p, or \X */ #define PCRE2_DUPCAPUSED 0x00200000 /* contains (?| */ #define PCRE2_HASBKC 0x00400000 /* contains \C */ +#define PCRE2_HASACCEPT 0x00800000 /* contains (*ACCEPT) */ #define PCRE2_MODE_MASK (PCRE2_MODE8 | PCRE2_MODE16 | PCRE2_MODE32) @@ -535,13 +536,14 @@ enum { PCRE2_MATCHEDBY_INTERPRETER, /* pcre2_match() */ #define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */ /* The maximum remaining length of subject we are prepared to search for a -req_unit match. In 8-bit mode, memchr() is used and is much faster than the -search loop that has to be used in 16-bit and 32-bit modes. */ +req_unit match from an anchored pattern. In 8-bit mode, memchr() is used and is +much faster than the search loop that has to be used in 16-bit and 32-bit +modes. */ #if PCRE2_CODE_UNIT_WIDTH == 8 -#define REQ_CU_MAX 2000 +#define REQ_CU_MAX 5000 #else -#define REQ_CU_MAX 1000 +#define REQ_CU_MAX 2000 #endif /* Offsets for the bitmap tables in the cbits set of tables. Each table @@ -881,12 +883,16 @@ a positive value. */ #define STRING_atomic0 "atomic\0" #define STRING_pla0 "pla\0" #define STRING_plb0 "plb\0" +#define STRING_napla0 "napla\0" +#define STRING_naplb0 "naplb\0" #define STRING_nla0 "nla\0" #define STRING_nlb0 "nlb\0" #define STRING_sr0 "sr\0" #define STRING_asr0 "asr\0" #define STRING_positive_lookahead0 "positive_lookahead\0" #define STRING_positive_lookbehind0 "positive_lookbehind\0" +#define STRING_non_atomic_positive_lookahead0 "non_atomic_positive_lookahead\0" +#define STRING_non_atomic_positive_lookbehind0 "non_atomic_positive_lookbehind\0" #define STRING_negative_lookahead0 "negative_lookahead\0" #define STRING_negative_lookbehind0 "negative_lookbehind\0" #define STRING_script_run0 "script_run\0" @@ -1171,12 +1177,16 @@ only. */ #define STRING_atomic0 STR_a STR_t STR_o STR_m STR_i STR_c "\0" #define STRING_pla0 STR_p STR_l STR_a "\0" #define STRING_plb0 STR_p STR_l STR_b "\0" +#define STRING_napla0 STR_n STR_a STR_p STR_l STR_a "\0" +#define STRING_naplb0 STR_n STR_a STR_p STR_l STR_b "\0" #define STRING_nla0 STR_n STR_l STR_a "\0" #define STRING_nlb0 STR_n STR_l STR_b "\0" #define STRING_sr0 STR_s STR_r "\0" #define STRING_asr0 STR_a STR_s STR_r "\0" #define STRING_positive_lookahead0 STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0" #define STRING_positive_lookbehind0 STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0" +#define STRING_non_atomic_positive_lookahead0 STR_n STR_o STR_n STR_UNDERSCORE STR_a STR_t STR_o STR_m STR_i STR_c STR_UNDERSCORE STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0" +#define STRING_non_atomic_positive_lookbehind0 STR_n STR_o STR_n STR_UNDERSCORE STR_a STR_t STR_o STR_m STR_i STR_c STR_UNDERSCORE STR_p STR_o STR_s STR_i STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0" #define STRING_negative_lookahead0 STR_n STR_e STR_g STR_a STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_a STR_h STR_e STR_a STR_d "\0" #define STRING_negative_lookbehind0 STR_n STR_e STR_g STR_a STR_t STR_i STR_v STR_e STR_UNDERSCORE STR_l STR_o STR_o STR_k STR_b STR_e STR_h STR_i STR_n STR_d "\0" #define STRING_script_run0 STR_s STR_c STR_r STR_i STR_p STR_t STR_UNDERSCORE STR_r STR_u STR_n "\0" @@ -1301,7 +1311,7 @@ enum { ESC_A = 1, ESC_G, ESC_K, ESC_B, ESC_b, ESC_D, ESC_d, ESC_S, ESC_s, Starting from 1 (i.e. after OP_END), the values up to OP_EOD must correspond in order to the list of escapes immediately above. Furthermore, values up to OP_DOLLM must not be changed without adjusting the table called autoposstab in -pcre2_auto_possess.c +pcre2_auto_possess.c. Whenever this list is updated, the two macro definitions that follow must be updated to match. The possessification table called "opcode_possessify" in @@ -1499,80 +1509,81 @@ enum { OP_KETRMIN, /* 123 order. They are for groups the repeat for ever. */ OP_KETRPOS, /* 124 Possessive unlimited repeat. */ - /* The assertions must come before BRA, CBRA, ONCE, and COND, and the four - asserts must remain in order. */ + /* The assertions must come before BRA, CBRA, ONCE, and COND. */ OP_REVERSE, /* 125 Move pointer back - used in lookbehind assertions */ OP_ASSERT, /* 126 Positive lookahead */ OP_ASSERT_NOT, /* 127 Negative lookahead */ OP_ASSERTBACK, /* 128 Positive lookbehind */ OP_ASSERTBACK_NOT, /* 129 Negative lookbehind */ + OP_ASSERT_NA, /* 130 Positive non-atomic lookahead */ + OP_ASSERTBACK_NA, /* 131 Positive non-atomic lookbehind */ /* ONCE, SCRIPT_RUN, BRA, BRAPOS, CBRA, CBRAPOS, and COND must come immediately after the assertions, with ONCE first, as there's a test for >= ONCE for a subpattern that isn't an assertion. The POS versions must immediately follow the non-POS versions in each case. */ - OP_ONCE, /* 130 Atomic group, contains captures */ - OP_SCRIPT_RUN, /* 131 Non-capture, but check characters' scripts */ - OP_BRA, /* 132 Start of non-capturing bracket */ - OP_BRAPOS, /* 133 Ditto, with unlimited, possessive repeat */ - OP_CBRA, /* 134 Start of capturing bracket */ - OP_CBRAPOS, /* 135 Ditto, with unlimited, possessive repeat */ - OP_COND, /* 136 Conditional group */ + OP_ONCE, /* 132 Atomic group, contains captures */ + OP_SCRIPT_RUN, /* 133 Non-capture, but check characters' scripts */ + OP_BRA, /* 134 Start of non-capturing bracket */ + OP_BRAPOS, /* 135 Ditto, with unlimited, possessive repeat */ + OP_CBRA, /* 136 Start of capturing bracket */ + OP_CBRAPOS, /* 137 Ditto, with unlimited, possessive repeat */ + OP_COND, /* 138 Conditional group */ /* These five must follow the previous five, in the same order. There's a check for >= SBRA to distinguish the two sets. */ - OP_SBRA, /* 137 Start of non-capturing bracket, check empty */ - OP_SBRAPOS, /* 138 Ditto, with unlimited, possessive repeat */ - OP_SCBRA, /* 139 Start of capturing bracket, check empty */ - OP_SCBRAPOS, /* 140 Ditto, with unlimited, possessive repeat */ - OP_SCOND, /* 141 Conditional group, check empty */ + OP_SBRA, /* 139 Start of non-capturing bracket, check empty */ + OP_SBRAPOS, /* 149 Ditto, with unlimited, possessive repeat */ + OP_SCBRA, /* 141 Start of capturing bracket, check empty */ + OP_SCBRAPOS, /* 142 Ditto, with unlimited, possessive repeat */ + OP_SCOND, /* 143 Conditional group, check empty */ /* The next two pairs must (respectively) be kept together. */ - OP_CREF, /* 142 Used to hold a capture number as condition */ - OP_DNCREF, /* 143 Used to point to duplicate names as a condition */ - OP_RREF, /* 144 Used to hold a recursion number as condition */ - OP_DNRREF, /* 145 Used to point to duplicate names as a condition */ - OP_FALSE, /* 146 Always false (used by DEFINE and VERSION) */ - OP_TRUE, /* 147 Always true (used by VERSION) */ + OP_CREF, /* 144 Used to hold a capture number as condition */ + OP_DNCREF, /* 145 Used to point to duplicate names as a condition */ + OP_RREF, /* 146 Used to hold a recursion number as condition */ + OP_DNRREF, /* 147 Used to point to duplicate names as a condition */ + OP_FALSE, /* 148 Always false (used by DEFINE and VERSION) */ + OP_TRUE, /* 149 Always true (used by VERSION) */ - OP_BRAZERO, /* 148 These two must remain together and in this */ - OP_BRAMINZERO, /* 149 order. */ - OP_BRAPOSZERO, /* 150 */ + OP_BRAZERO, /* 150 These two must remain together and in this */ + OP_BRAMINZERO, /* 151 order. */ + OP_BRAPOSZERO, /* 152 */ /* These are backtracking control verbs */ - OP_MARK, /* 151 always has an argument */ - OP_PRUNE, /* 152 */ - OP_PRUNE_ARG, /* 153 same, but with argument */ - OP_SKIP, /* 154 */ - OP_SKIP_ARG, /* 155 same, but with argument */ - OP_THEN, /* 156 */ - OP_THEN_ARG, /* 157 same, but with argument */ - OP_COMMIT, /* 158 */ - OP_COMMIT_ARG, /* 159 same, but with argument */ + OP_MARK, /* 153 always has an argument */ + OP_PRUNE, /* 154 */ + OP_PRUNE_ARG, /* 155 same, but with argument */ + OP_SKIP, /* 156 */ + OP_SKIP_ARG, /* 157 same, but with argument */ + OP_THEN, /* 158 */ + OP_THEN_ARG, /* 159 same, but with argument */ + OP_COMMIT, /* 160 */ + OP_COMMIT_ARG, /* 161 same, but with argument */ /* These are forced failure and success verbs. FAIL and ACCEPT do accept an argument, but these cases can be compiled as, for example, (*MARK:X)(*FAIL) without the need for a special opcode. */ - OP_FAIL, /* 160 */ - OP_ACCEPT, /* 161 */ - OP_ASSERT_ACCEPT, /* 162 Used inside assertions */ - OP_CLOSE, /* 163 Used before OP_ACCEPT to close open captures */ + OP_FAIL, /* 162 */ + OP_ACCEPT, /* 163 */ + OP_ASSERT_ACCEPT, /* 164 Used inside assertions */ + OP_CLOSE, /* 165 Used before OP_ACCEPT to close open captures */ /* This is used to skip a subpattern with a {0} quantifier */ - OP_SKIPZERO, /* 164 */ + OP_SKIPZERO, /* 166 */ /* This is used to identify a DEFINE group during compilation so that it can be checked for having only one branch. It is changed to OP_FALSE before compilation finishes. */ - OP_DEFINE, /* 165 */ + OP_DEFINE, /* 167 */ /* This is not an opcode, but is used to check that tables indexed by opcode are the correct length, in order to catch updating errors - there have been @@ -1585,7 +1596,7 @@ enum { /* *** NOTE NOTE NOTE *** Whenever the list above is updated, the two macro definitions that follow must also be updated to match. There are also tables called "opcode_possessify" in pcre2_compile.c and "coptable" and "poptable" in -pcre2_dfa_exec.c that must be updated. */ +pcre2_dfa_match.c that must be updated. */ /* This macro defines textual names for all the opcodes. These are used only @@ -1618,7 +1629,9 @@ some cases doesn't actually use these names at all). */ "class", "nclass", "xclass", "Ref", "Refi", "DnRef", "DnRefi", \ "Recurse", "Callout", "CalloutStr", \ "Alt", "Ket", "KetRmax", "KetRmin", "KetRpos", \ - "Reverse", "Assert", "Assert not", "AssertB", "AssertB not", \ + "Reverse", "Assert", "Assert not", \ + "Assert back", "Assert back not", \ + "Non-atomic assert", "Non-atomic assert back", \ "Once", \ "Script run", \ "Bra", "BraPos", "CBra", "CBraPos", \ @@ -1703,6 +1716,8 @@ in UTF-8 mode. The code that uses this table must know about such things. */ 1+LINK_SIZE, /* Assert not */ \ 1+LINK_SIZE, /* Assert behind */ \ 1+LINK_SIZE, /* Assert behind not */ \ + 1+LINK_SIZE, /* NA Assert */ \ + 1+LINK_SIZE, /* NA Assert behind */ \ 1+LINK_SIZE, /* ONCE */ \ 1+LINK_SIZE, /* SCRIPT_RUN */ \ 1+LINK_SIZE, /* BRA */ \ diff --git a/src/3rdparty/pcre2/src/pcre2_intmodedep.h b/src/3rdparty/pcre2/src/pcre2_intmodedep.h index bf3a235984..ea3b3ec698 100644 --- a/src/3rdparty/pcre2/src/pcre2_intmodedep.h +++ b/src/3rdparty/pcre2/src/pcre2_intmodedep.h @@ -205,19 +205,19 @@ whether its argument, which is assumed to be one code unit, is less than 256. The CHMAX_255 macro does not assume one code unit. The maximum length of a MARK name must fit in one code unit; currently it is set to 255 or 65535. The TABLE_GET macro is used to access elements of tables containing exactly 256 -items. When code points can be greater than 255, a check is needed before -accessing these tables. */ +items. Its argument is a code unit. When code points can be greater than 255, a +check is needed before accessing these tables. */ #if PCRE2_CODE_UNIT_WIDTH == 8 #define MAX_255(c) TRUE #define MAX_MARK ((1u << 8) - 1) +#define TABLE_GET(c, table, default) ((table)[c]) #ifdef SUPPORT_UNICODE #define SUPPORT_WIDE_CHARS #define CHMAX_255(c) ((c) <= 255u) #else #define CHMAX_255(c) TRUE #endif /* SUPPORT_UNICODE */ -#define TABLE_GET(c, table, default) ((table)[c]) #else /* Code units are 16 or 32 bits */ #define CHMAX_255(c) ((c) <= 255u) @@ -228,7 +228,6 @@ accessing these tables. */ #endif - /* ----------------- Character-handling macros ----------------- */ /* There is a proposed future special "UTF-21" mode, in which only the lowest @@ -854,6 +853,7 @@ typedef struct match_block { uint32_t match_call_count; /* Number of times a new frame is created */ BOOL hitend; /* Hit the end of the subject at some point */ BOOL hasthen; /* Pattern contains (*THEN) */ + BOOL allowemptypartial; /* Allow empty hard partial */ const uint8_t *lcc; /* Points to lower casing table */ const uint8_t *fcc; /* Points to case-flipping table */ const uint8_t *ctypes; /* Points to table of type maps */ @@ -866,6 +866,7 @@ typedef struct match_block { PCRE2_SPTR name_table; /* Table of group names */ PCRE2_SPTR start_code; /* For use when recursing */ PCRE2_SPTR start_subject; /* Start of the subject string */ + PCRE2_SPTR check_subject; /* Where UTF-checked from */ PCRE2_SPTR end_subject; /* End of the subject string */ PCRE2_SPTR end_match_ptr; /* Subject position at end match */ PCRE2_SPTR start_used_ptr; /* Earliest consulted character */ @@ -908,6 +909,7 @@ typedef struct dfa_match_block { uint32_t poptions; /* Pattern options */ uint32_t nltype; /* Newline type */ uint32_t nllen; /* Newline string length */ + BOOL allowemptypartial; /* Allow empty hard partial */ PCRE2_UCHAR nl[4]; /* Newline string when fixed */ uint16_t bsr_convention; /* \R interpretation */ pcre2_callout_block *cb; /* Points to a callout block */ diff --git a/src/3rdparty/pcre2/src/pcre2_jit_compile.c b/src/3rdparty/pcre2/src/pcre2_jit_compile.c index 1f21bfb6ad..f564127c2a 100644 --- a/src/3rdparty/pcre2/src/pcre2_jit_compile.c +++ b/src/3rdparty/pcre2/src/pcre2_jit_compile.c @@ -6,8 +6,9 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel + This module by Zoltan Herczeg Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2018 University of Cambridge + New API code Copyright (c) 2016-2019 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -212,12 +213,6 @@ typedef struct stub_list { struct stub_list *next; } stub_list; -typedef struct label_addr_list { - struct sljit_label *label; - sljit_uw *update_addr; - struct label_addr_list *next; -} label_addr_list; - enum frame_types { no_frame = -1, no_stack = -2 @@ -271,6 +266,8 @@ typedef struct bracket_backtrack { assert_backtrack *assert; /* For OP_ONCE. Less than 0 if not needed. */ int framesize; + /* For brackets with >3 alternatives. */ + struct sljit_put_label *matching_put_label; } u; /* Points to our private memory word on the stack. */ int private_data_ptr; @@ -416,6 +413,8 @@ typedef struct compiler_common { sljit_sw lcc; /* Mode can be PCRE2_JIT_COMPLETE and others. */ int mode; + /* TRUE, when empty match is accepted for partial matching. */ + BOOL allow_empty_partial; /* TRUE, when minlength is greater than 0. */ BOOL might_be_empty; /* \K is found in the pattern. */ @@ -454,7 +453,6 @@ typedef struct compiler_common { struct sljit_label *accept_label; struct sljit_label *ff_newline_shortcut; stub_list *stubs; - label_addr_list *label_addrs; recurse_entry *entries; recurse_entry *currententry; jump_list *partialmatch; @@ -563,6 +561,12 @@ typedef struct compare_context { #define ARGUMENTS SLJIT_S4 #define RETURN_ADDR SLJIT_R4 +#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) +#define HAS_VIRTUAL_REGISTERS 1 +#else +#define HAS_VIRTUAL_REGISTERS 0 +#endif + /* Local space layout. */ /* These two locals can be used by the current opcode. */ #define LOCALS0 (0 * sizeof(sljit_sw)) @@ -696,11 +700,12 @@ the start pointers when the end of the capturing group has not yet reached. */ #define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \ { \ - if (ptr[-1] <= 0x7f) \ - c = *ptr--; \ + c = ptr[-1]; \ + if (c <= 0x7f) \ + ptr--; \ else if (ptr - 1 > start && ptr[-1] >= 0x80 && ptr[-1] < 0xc0) \ { \ - c = ptr[-1] - 0x80; \ + c -= 0x80; \ \ if (ptr[-2] >= 0xc2 && ptr[-2] <= 0xdf) \ { \ @@ -775,11 +780,12 @@ the start pointers when the end of the capturing group has not yet reached. */ #define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \ { \ - if (ptr[-1] < 0xd800 || ptr[-1] >= 0xe000) \ - c = *ptr--; \ - else if (ptr[-1] >= 0xdc00 && ptr - 1 > start && ptr[-2] >= 0xd800 && ptr[-2] < 0xdc00) \ + c = ptr[-1]; \ + if (c < 0xd800 || c >= 0xe000) \ + ptr--; \ + else if (c >= 0xdc00 && ptr - 1 > start && ptr[-2] >= 0xd800 && ptr[-2] < 0xdc00) \ { \ - c = (((ptr[-2] - 0xd800) << 10) | (ptr[-1] - 0xdc00)) + 0x10000; \ + c = (((ptr[-2] - 0xd800) << 10) | (c - 0xdc00)) + 0x10000; \ ptr -= 2; \ } \ else \ @@ -793,7 +799,7 @@ the start pointers when the end of the capturing group has not yet reached. */ #define GETCHARINC_INVALID(c, ptr, end, invalid_action) \ { \ - if (ptr[0] < 0x110000) \ + if (ptr[0] < 0xd800 || (ptr[0] >= 0xe000 && ptr[0] < 0x110000)) \ c = *ptr++; \ else \ { \ @@ -801,6 +807,17 @@ the start pointers when the end of the capturing group has not yet reached. */ } \ } +#define GETCHARBACK_INVALID(c, ptr, start, invalid_action) \ + { \ + c = ptr[-1]; \ + if (ptr[-1] < 0xd800 || (ptr[-1] >= 0xe000 && ptr[-1] < 0x110000)) \ + ptr--; \ + else \ + { \ + invalid_action; \ + } \ + } + #endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */ #endif /* SUPPORT_UNICODE */ @@ -1033,8 +1050,8 @@ switch(*cc) return cc + 1 + 2 + cc[1]; default: - /* All opcodes are supported now! */ - SLJIT_UNREACHABLE(); + /* Unsupported opcodes: OP_ASSERT_NA and OP_ASSERTBACK_NA */ + /* SLJIT_UNREACHABLE(); */ return NULL; } } @@ -2371,14 +2388,14 @@ if (base_reg != TMP2) else { status.saved_tmp_regs[1] = RETURN_ADDR; - if (sljit_get_register_index(RETURN_ADDR) == -1) + if (HAS_VIRTUAL_REGISTERS) status.tmp_regs[1] = STR_PTR; else status.tmp_regs[1] = RETURN_ADDR; } status.saved_tmp_regs[2] = TMP3; -if (sljit_get_register_index(TMP3) == -1) +if (HAS_VIRTUAL_REGISTERS) status.tmp_regs[2] = STR_END; else status.tmp_regs[2] = TMP3; @@ -2829,20 +2846,6 @@ while (list_item) common->stubs = NULL; } -static void add_label_addr(compiler_common *common, sljit_uw *update_addr) -{ -DEFINE_COMPILER; -label_addr_list *label_addr; - -label_addr = sljit_alloc_memory(compiler, sizeof(label_addr_list)); -if (label_addr == NULL) - return; -label_addr->label = LABEL(); -label_addr->update_addr = update_addr; -label_addr->next = common->label_addrs; -common->label_addrs = label_addr; -} - static SLJIT_INLINE void count_match(compiler_common *common) { DEFINE_COMPILER; @@ -2985,12 +2988,18 @@ else } } -OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0); +if (!HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, stack)); +else + OP1(SLJIT_MOV, STACK_TOP, 0, ARGUMENTS, 0); + if (common->mark_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, SLJIT_IMM, 0); if (common->control_head_ptr != 0) OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr, SLJIT_IMM, 0); -OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack)); +if (HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(jit_arguments, stack)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); OP1(SLJIT_MOV, STACK_TOP, 0, SLJIT_MEM1(STACK_TOP), SLJIT_OFFSETOF(struct sljit_stack, end)); } @@ -3029,21 +3038,36 @@ BOOL has_pre; OP1(SLJIT_MOV, SLJIT_S2, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(1)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), OVECTOR(1), STR_PTR, 0); -OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0); -OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); -if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); -OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount)); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0); -if (common->mark_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0); -OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, match_data), - SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE)); +if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, SLJIT_R0, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); + if (common->mark_ptr != 0) + OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); + OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, oveccount)); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0); + if (common->mark_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R2, 0); + OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, match_data), + SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE)); + } +else + { + OP1(SLJIT_MOV, SLJIT_S0, 0, SLJIT_MEM1(SLJIT_SP), common->start_ptr); + OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, match_data)); + if (common->mark_ptr != 0) + OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); + OP1(SLJIT_MOV_U32, SLJIT_R1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, oveccount)); + OP1(SLJIT_MOV, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_S0, 0); + if (common->mark_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), SLJIT_R0, 0); + OP2(SLJIT_ADD, SLJIT_R2, 0, SLJIT_R2, 0, SLJIT_IMM, SLJIT_OFFSETOF(pcre2_match_data, ovector) - sizeof(PCRE2_SIZE)); + } has_pre = sljit_emit_mem(compiler, SLJIT_MOV | SLJIT_MEM_SUPP | SLJIT_MEM_PRE, SLJIT_S1, SLJIT_MEM1(SLJIT_S0), sizeof(sljit_sw)) == SLJIT_SUCCESS; GET_LOCAL_BASE(SLJIT_S0, 0, OVECTOR_START - (has_pre ? sizeof(sljit_sw) : 0)); -OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_R0), SLJIT_OFFSETOF(jit_arguments, begin)); +OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? SLJIT_R0 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); loop = LABEL(); @@ -3105,20 +3129,22 @@ static SLJIT_INLINE void return_with_partial_match(compiler_common *common, stru { DEFINE_COMPILER; sljit_s32 mov_opcode; +sljit_s32 arguments_reg = !HAS_VIRTUAL_REGISTERS ? ARGUMENTS : SLJIT_R1; SLJIT_COMPILE_ASSERT(STR_END == SLJIT_S0, str_end_must_be_saved_reg0); SLJIT_ASSERT(common->start_used_ptr != 0 && common->start_ptr != 0 && (common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start != 0 : common->hit_start == 0)); -OP1(SLJIT_MOV, SLJIT_R1, 0, ARGUMENTS, 0); +if (arguments_reg != ARGUMENTS) + OP1(SLJIT_MOV, arguments_reg, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_MEM1(SLJIT_SP), common->mode == PCRE2_JIT_PARTIAL_SOFT ? common->hit_start : common->start_ptr); OP1(SLJIT_MOV, SLJIT_RETURN_REG, 0, SLJIT_IMM, PCRE2_ERROR_PARTIAL); /* Store match begin and end. */ -OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, begin)); -OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0); -OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_R1), SLJIT_OFFSETOF(jit_arguments, match_data)); +OP1(SLJIT_MOV, SLJIT_S1, 0, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, begin)); +OP1(SLJIT_MOV, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, startchar_ptr), SLJIT_R2, 0); +OP1(SLJIT_MOV, SLJIT_R1, 0, SLJIT_MEM1(arguments_reg), SLJIT_OFFSETOF(jit_arguments, match_data)); mov_opcode = (sizeof(PCRE2_SIZE) == 4) ? SLJIT_MOV_U32 : SLJIT_MOV; @@ -3279,7 +3305,7 @@ SLJIT_ASSERT(!force || common->mode != PCRE2_JIT_COMPLETE); if (common->mode == PCRE2_JIT_COMPLETE) return; -if (!force) +if (!force && !common->allow_empty_partial) jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); else if (common->mode == PCRE2_JIT_PARTIAL_SOFT) jump = CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1); @@ -3341,7 +3367,11 @@ if (common->mode == PCRE2_JIT_COMPLETE) /* Partial matching mode. */ jump = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0); -add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); +if (!common->allow_empty_partial) + add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); +else if (common->mode == PCRE2_JIT_PARTIAL_SOFT) + add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, SLJIT_IMM, -1)); + if (common->mode == PCRE2_JIT_PARTIAL_SOFT) { OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); @@ -3357,6 +3387,35 @@ else JUMPHERE(jump); } +static void process_partial_match(compiler_common *common) +{ +DEFINE_COMPILER; +struct sljit_jump *jump; + +/* Partial matching mode. */ +if (common->mode == PCRE2_JIT_PARTIAL_SOFT) + { + jump = CMP(SLJIT_GREATER_EQUAL, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->hit_start, SLJIT_IMM, 0); + JUMPHERE(jump); + } +else if (common->mode == PCRE2_JIT_PARTIAL_HARD) + { + if (common->partialmatchlabel != NULL) + CMPTO(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0, common->partialmatchlabel); + else + add_jump(compiler, &common->partialmatch, CMP(SLJIT_LESS, SLJIT_MEM1(SLJIT_SP), common->start_used_ptr, STR_PTR, 0)); + } +} + +static void detect_partial_match_to(compiler_common *common, struct sljit_label *label) +{ +DEFINE_COMPILER; + +CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, label); +process_partial_match(common); +} + static void peek_char(compiler_common *common, sljit_u32 max, sljit_s32 dst, sljit_sw dstw, jump_list **backtracks) { /* Reads the character into TMP1, keeps STR_PTR. @@ -3420,12 +3479,21 @@ if (common->utf) #elif PCRE2_CODE_UNIT_WIDTH == 32 if (common->invalid_utf) { + if (max < 0xd800) return; + if (backtracks != NULL) + { + OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000)); + add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800)); + } else { + OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x110000); CMOV(SLJIT_GREATER_EQUAL, TMP1, SLJIT_IMM, INVALID_UTF_CHAR); + OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800); + CMOV(SLJIT_LESS, TMP1, SLJIT_IMM, INVALID_UTF_CHAR); } } #endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */ @@ -3490,8 +3558,12 @@ if (common->utf) JUMPHERE(jump); } #elif PCRE2_CODE_UNIT_WIDTH == 32 - if (common->invalid_utf) - add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000)); +if (common->invalid_utf) + { + OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); + add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000)); + add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800)); + } #endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */ #endif /* SUPPORT_UNICODE */ } @@ -3653,7 +3725,7 @@ if (common->utf) /* Skip low surrogate if necessary. */ OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); - if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && sljit_get_register_index(RETURN_ADDR) >= 0) + if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && !HAS_VIRTUAL_REGISTERS) { if (options & READ_CHAR_UPDATE_STR_PTR) OP2(SLJIT_ADD, RETURN_ADDR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); @@ -3677,11 +3749,18 @@ if (common->utf) if (common->invalid_utf) { if (backtracks != NULL) + { + OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); add_jump(compiler, backtracks, CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 0x110000)); + add_jump(compiler, backtracks, CMP(SLJIT_LESS, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800)); + } else { + OP2(SLJIT_SUB, TMP2, 0, TMP1, 0, SLJIT_IMM, 0xd800); OP2(SLJIT_SUB | SLJIT_SET_GREATER_EQUAL, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0x110000); CMOV(SLJIT_GREATER_EQUAL, TMP1, SLJIT_IMM, INVALID_UTF_CHAR); + OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0xe000 - 0xd800); + CMOV(SLJIT_LESS, TMP1, SLJIT_IMM, INVALID_UTF_CHAR); } } #endif /* PCRE2_CODE_UNIT_WIDTH == [8|16|32] */ @@ -3832,7 +3911,7 @@ if (common->utf && negated) { OP2(SLJIT_SUB, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xd800); - if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && sljit_get_register_index(RETURN_ADDR) >= 0) + if (sljit_has_cpu_feature(SLJIT_HAS_CMOV) && !HAS_VIRTUAL_REGISTERS) { OP2(SLJIT_ADD, RETURN_ADDR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0x400); @@ -3865,9 +3944,9 @@ if (common->utf && negated) static void move_back(compiler_common *common, jump_list **backtracks, BOOL must_be_valid) { -/* Goes one character back. TMP2 must contain the start of -the subject buffer. Affects STR_PTR and TMP1. Does not modify -STR_PTR for invalid character sequences. */ +/* Goes one character back. Affects STR_PTR and TMP1. If must_be_valid is TRUE, +TMP2 is not used. Otherwise TMP2 must contain the start of the subject buffer, +and it is destroyed. Does not modify STR_PTR for invalid character sequences. */ DEFINE_COMPILER; SLJIT_UNUSED_ARG(backtracks); @@ -4407,7 +4486,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); static void do_utfpeakcharback(compiler_common *common) { -/* Peak a character back. */ +/* Peak a character back. Does not modify STR_PTR. */ DEFINE_COMPILER; struct sljit_jump *jump[2]; @@ -4444,7 +4523,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); static void do_utfpeakcharback_invalid(compiler_common *common) { -/* Peak a character back. */ +/* Peak a character back. Does not modify STR_PTR. */ DEFINE_COMPILER; sljit_s32 i; sljit_s32 has_cmov = sljit_has_cpu_feature(SLJIT_HAS_CMOV); @@ -4672,7 +4751,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); static void do_utfpeakcharback_invalid(compiler_common *common) { -/* Peak a character back. */ +/* Peak a character back. Does not modify STR_PTR. */ DEFINE_COMPILER; struct sljit_jump *jump; struct sljit_jump *exit_invalid[3]; @@ -4786,18 +4865,12 @@ OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_stage2)); OP1(SLJIT_MOV_U16, TMP2, 0, SLJIT_MEM2(TMP2, TMP1), 1); -// PH hacking -//fprintf(stderr, "~~A\n"); - OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2); - OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3); - OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype)); - +/* TMP2 is multiplied by 12. Same as (TMP2 << 2) + ((TMP2 << 2) << 1). */ OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, (sljit_sw)PRIV(ucd_records) + SLJIT_OFFSETOF(ucd_record, chartype)); +OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 2); +OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP2, 0); +OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 1); - OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 0); - -// OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(TMP1, TMP2), 3); sljit_emit_fast_return(compiler, RETURN_ADDR, 0); } @@ -4866,15 +4939,27 @@ else if ((overall_options & PCRE2_USE_OFFSET_LIMIT) != 0) /* Check whether offset limit is set and valid. */ SLJIT_ASSERT(common->match_end_ptr != 0); - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, offset_limit)); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, offset_limit)); + } + else + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, offset_limit)); + OP1(SLJIT_MOV, TMP2, 0, STR_END, 0); end = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, (sljit_sw) PCRE2_UNSET); - OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); + if (HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); + else + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); + #if PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32 OP2(SLJIT_SHL, TMP1, 0, TMP1, 0, SLJIT_IMM, UCHAR_SHIFT); #endif /* PCRE2_CODE_UNIT_WIDTH == [16|32] */ - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin)); + if (HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin)); + OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); end2 = CMP(SLJIT_LESS_EQUAL, TMP2, 0, STR_END, 0); OP1(SLJIT_MOV, TMP2, 0, STR_END, 0); @@ -5434,802 +5519,157 @@ CMPTO(SLJIT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00, label); } #endif -#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) - -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -static struct sljit_jump *jump_if_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg) -{ -#if PCRE2_CODE_UNIT_WIDTH == 8 -OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0); -return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0x80); -#elif PCRE2_CODE_UNIT_WIDTH == 16 -OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00); -return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00); -#else -#error "Unknown code width" -#endif -} -#endif +#include "pcre2_jit_simd_inc.h" -static sljit_s32 character_to_int32(PCRE2_UCHAR chr) -{ -sljit_u32 value = chr; -#if PCRE2_CODE_UNIT_WIDTH == 8 -#define SSE2_COMPARE_TYPE_INDEX 0 -return (sljit_s32)((value << 24) | (value << 16) | (value << 8) | value); -#elif PCRE2_CODE_UNIT_WIDTH == 16 -#define SSE2_COMPARE_TYPE_INDEX 1 -return (sljit_s32)((value << 16) | value); -#elif PCRE2_CODE_UNIT_WIDTH == 32 -#define SSE2_COMPARE_TYPE_INDEX 2 -return (sljit_s32)(value); -#else -#error "Unsupported unit width" -#endif -} +#ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD -static void load_from_mem_sse2(struct sljit_compiler *compiler, sljit_s32 dst_xmm_reg, sljit_s32 src_general_reg) +static BOOL check_fast_forward_char_pair_simd(compiler_common *common, fast_forward_char_data *chars, int max) { -#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) -sljit_u8 instruction[5]; -#else -sljit_u8 instruction[4]; -#endif + sljit_s32 i, j, max_i = 0, max_j = 0; + sljit_u32 max_pri = 0; + PCRE2_UCHAR a1, a2, a_pri, b1, b2, b_pri; -SLJIT_ASSERT(dst_xmm_reg < 8); + for (i = max - 1; i >= 1; i--) + { + if (chars[i].last_count > 2) + { + a1 = chars[i].chars[0]; + a2 = chars[i].chars[1]; + a_pri = chars[i].last_count; -/* MOVDQA xmm1, xmm2/m128 */ -#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) -if (src_general_reg < 8) - { - instruction[0] = 0x66; - instruction[1] = 0x0f; - instruction[2] = 0x6f; - instruction[3] = (dst_xmm_reg << 3) | src_general_reg; - sljit_emit_op_custom(compiler, instruction, 4); - } -else - { - instruction[0] = 0x66; - instruction[1] = 0x41; - instruction[2] = 0x0f; - instruction[3] = 0x6f; - instruction[4] = (dst_xmm_reg << 3) | (src_general_reg & 0x7); - sljit_emit_op_custom(compiler, instruction, 4); - } -#else -instruction[0] = 0x66; -instruction[1] = 0x0f; -instruction[2] = 0x6f; -instruction[3] = (dst_xmm_reg << 3) | src_general_reg; -sljit_emit_op_custom(compiler, instruction, 4); -#endif -} + j = i - max_fast_forward_char_pair_offset(); + if (j < 0) + j = 0; -static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, PCRE2_UCHAR char1, PCRE2_UCHAR char2, - sljit_u32 bit, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind) -{ -sljit_u8 instruction[4]; -instruction[0] = 0x66; -instruction[1] = 0x0f; + while (j < i) + { + b_pri = chars[j].last_count; + if (b_pri > 2 && a_pri + b_pri >= max_pri) + { + b1 = chars[j].chars[0]; + b2 = chars[j].chars[1]; -if (char1 == char2 || bit != 0) - { - if (bit != 0) - { - /* POR xmm1, xmm2/m128 */ - /* instruction[0] = 0x66; */ - /* instruction[1] = 0x0f; */ - instruction[2] = 0xeb; - instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind; - sljit_emit_op_custom(compiler, instruction, 4); + if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2) + { + max_pri = a_pri + b_pri; + max_i = i; + max_j = j; + } + } + j++; + } + } } - /* PCMPEQB/W/D xmm1, xmm2/m128 */ - /* instruction[0] = 0x66; */ - /* instruction[1] = 0x0f; */ - instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; - instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; - sljit_emit_op_custom(compiler, instruction, 4); - } -else - { - /* MOVDQA xmm1, xmm2/m128 */ - /* instruction[0] = 0x66; */ - /* instruction[1] = 0x0f; */ - instruction[2] = 0x6f; - instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind; - sljit_emit_op_custom(compiler, instruction, 4); - - /* PCMPEQB/W/D xmm1, xmm2/m128 */ - /* instruction[0] = 0x66; */ - /* instruction[1] = 0x0f; */ - instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; - instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; - sljit_emit_op_custom(compiler, instruction, 4); - - instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind; - sljit_emit_op_custom(compiler, instruction, 4); +if (max_pri == 0) + return FALSE; - /* POR xmm1, xmm2/m128 */ - /* instruction[0] = 0x66; */ - /* instruction[1] = 0x0f; */ - instruction[2] = 0xeb; - instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind; - sljit_emit_op_custom(compiler, instruction, 4); - } +fast_forward_char_pair_simd(common, max_i, chars[max_i].chars[0], chars[max_i].chars[1], max_j, chars[max_j].chars[0], chars[max_j].chars[1]); +return TRUE; } -static void fast_forward_first_char2_sse2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset) +#endif /* JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD */ + +static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset) { DEFINE_COMPILER; struct sljit_label *start; -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -struct sljit_label *restart; -#endif -struct sljit_jump *quit; -struct sljit_jump *partial_quit[2]; -sljit_u8 instruction[8]; -sljit_s32 tmp1_ind = sljit_get_register_index(TMP1); -sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR); -sljit_s32 data_ind = 0; -sljit_s32 tmp_ind = 1; -sljit_s32 cmp1_ind = 2; -sljit_s32 cmp2_ind = 3; -sljit_u32 bit = 0; - -SLJIT_UNUSED_ARG(offset); - -if (char1 != char2) - { - bit = char1 ^ char2; - if (!is_powerof2(bit)) - bit = 0; - } - -partial_quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); -if (common->mode == PCRE2_JIT_COMPLETE) - add_jump(compiler, &common->failed_match, partial_quit[0]); - -/* First part (unaligned start) */ +struct sljit_jump *match; +struct sljit_jump *partial_quit; +PCRE2_UCHAR mask; +BOOL has_match_end = (common->match_end_ptr != 0); -OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1 | bit)); +SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE || offset == 0); -SLJIT_ASSERT(tmp1_ind < 8); +if (has_match_end) + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); -/* MOVD xmm, r/m32 */ -instruction[0] = 0x66; -instruction[1] = 0x0f; -instruction[2] = 0x6e; -instruction[3] = 0xc0 | (cmp1_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 4); +if (offset > 0) + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset)); -if (char1 != char2) +if (has_match_end) { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(bit != 0 ? bit : char2)); + OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - /* MOVD xmm, r/m32 */ - instruction[3] = 0xc0 | (cmp2_ind << 3) | tmp1_ind; - sljit_emit_op_custom(compiler, instruction, 4); + OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offset + 1)); + OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0); + CMOV(SLJIT_GREATER, STR_END, TMP1, 0); } -OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); - -/* PSHUFD xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x70; -instruction[3] = 0xc0 | (cmp1_ind << 3) | 2; -instruction[4] = 0; -sljit_emit_op_custom(compiler, instruction, 5); +#ifdef JIT_HAS_FAST_FORWARD_CHAR_SIMD -if (char1 != char2) +if (JIT_HAS_FAST_FORWARD_CHAR_SIMD) { - /* PSHUFD xmm1, xmm2/m128, imm8 */ - instruction[3] = 0xc0 | (cmp2_ind << 3) | 3; - sljit_emit_op_custom(compiler, instruction, 5); - } - -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -restart = LABEL(); -#endif -OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf); -OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf); - -load_from_mem_sse2(compiler, data_ind, str_ptr_ind); -fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind); - -/* PMOVMSKB reg, xmm */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xd7; -instruction[3] = 0xc0 | (tmp1_ind << 3) | 0; -sljit_emit_op_custom(compiler, instruction, 4); - -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0); -OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0); + fast_forward_char_simd(common, char1, char2, offset); -/* BSF r32, r/m32 */ -instruction[0] = 0x0f; -instruction[1] = 0xbc; -instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 3); -sljit_set_current_flags(compiler, SLJIT_SET_Z); + if (offset > 0) + OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset)); -quit = JUMP(SLJIT_NOT_ZERO); + if (has_match_end) + OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); + return; + } -OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); +#endif start = LABEL(); -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16); -partial_quit[1] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); +partial_quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); if (common->mode == PCRE2_JIT_COMPLETE) - add_jump(compiler, &common->failed_match, partial_quit[1]); - -/* Second part (aligned) */ - -load_from_mem_sse2(compiler, 0, str_ptr_ind); -fast_forward_char_pair_sse2_compare(compiler, char1, char2, bit, data_ind, cmp1_ind, cmp2_ind, tmp_ind); - -/* PMOVMSKB reg, xmm */ -instruction[0] = 0x66; -instruction[1] = 0x0f; -instruction[2] = 0xd7; -instruction[3] = 0xc0 | (tmp1_ind << 3) | 0; -sljit_emit_op_custom(compiler, instruction, 4); - -/* BSF r32, r/m32 */ -instruction[0] = 0x0f; -instruction[1] = 0xbc; -instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 3); -sljit_set_current_flags(compiler, SLJIT_SET_Z); - -JUMPTO(SLJIT_ZERO, start); + add_jump(compiler, &common->failed_match, partial_quit); -JUMPHERE(quit); -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); +OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0); +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); -if (common->mode != PCRE2_JIT_COMPLETE) +if (char1 == char2) + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1, start); +else { - JUMPHERE(partial_quit[0]); - JUMPHERE(partial_quit[1]); - OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0); - CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); + mask = char1 ^ char2; + if (is_powerof2(mask)) + { + OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, mask); + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1 | mask, start); + } + else + { + match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, char1); + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char2, start); + JUMPHERE(match); + } } -else - add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf && offset > 0) { - SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE); - - OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset)); - - quit = jump_if_utf_char_start(compiler, TMP1); - - OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); - OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); - JUMPTO(SLJIT_JUMP, restart); - - JUMPHERE(quit); + OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-(offset + 1))); + jumpto_if_not_utf_char_start(compiler, TMP1, start); } #endif -} -#ifndef _WIN64 +OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset + 1)); -static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_sse2_offset(void) -{ -#if PCRE2_CODE_UNIT_WIDTH == 8 -return 15; -#elif PCRE2_CODE_UNIT_WIDTH == 16 -return 7; -#elif PCRE2_CODE_UNIT_WIDTH == 32 -return 3; -#else -#error "Unsupported unit width" -#endif +if (common->mode != PCRE2_JIT_COMPLETE) + JUMPHERE(partial_quit); + +if (has_match_end) + OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); } -static void fast_forward_char_pair_sse2(compiler_common *common, sljit_s32 offs1, - PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b) +static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common) { DEFINE_COMPILER; -sljit_u32 bit1 = 0; -sljit_u32 bit2 = 0; -sljit_u32 diff = IN_UCHARS(offs1 - offs2); -sljit_s32 tmp1_ind = sljit_get_register_index(TMP1); -sljit_s32 tmp2_ind = sljit_get_register_index(TMP2); -sljit_s32 str_ptr_ind = sljit_get_register_index(STR_PTR); -sljit_s32 data1_ind = 0; -sljit_s32 data2_ind = 1; -sljit_s32 tmp_ind = 2; -sljit_s32 cmp1a_ind = 3; -sljit_s32 cmp1b_ind = 4; -sljit_s32 cmp2a_ind = 5; -sljit_s32 cmp2b_ind = 6; struct sljit_label *start; -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -struct sljit_label *restart; -#endif -struct sljit_jump *jump[2]; - -sljit_u8 instruction[8]; - -SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2); -SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_sse2_offset())); -SLJIT_ASSERT(tmp1_ind < 8 && tmp2_ind == 1); - -/* Initialize. */ -if (common->match_end_ptr != 0) - { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); - OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1)); - - OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0); - CMOV(SLJIT_LESS, STR_END, TMP1, 0); - } - -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1)); -add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); - -/* MOVD xmm, r/m32 */ -instruction[0] = 0x66; -instruction[1] = 0x0f; -instruction[2] = 0x6e; - -if (char1a == char1b) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a)); -else - { - bit1 = char1a ^ char1b; - if (is_powerof2(bit1)) - { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a | bit1)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit1)); - } - else - { - bit1 = 0; - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char1b)); - } - } - -instruction[3] = 0xc0 | (cmp1a_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -if (char1a != char1b) - { - instruction[3] = 0xc0 | (cmp1b_ind << 3) | tmp2_ind; - sljit_emit_op_custom(compiler, instruction, 4); - } - -if (char2a == char2b) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a)); -else - { - bit2 = char2a ^ char2b; - if (is_powerof2(bit2)) - { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a | bit2)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit2)); - } - else - { - bit2 = 0; - OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a)); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char2b)); - } - } - -instruction[3] = 0xc0 | (cmp2a_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -if (char2a != char2b) - { - instruction[3] = 0xc0 | (cmp2b_ind << 3) | tmp2_ind; - sljit_emit_op_custom(compiler, instruction, 4); - } - -/* PSHUFD xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x70; -instruction[4] = 0; - -instruction[3] = 0xc0 | (cmp1a_ind << 3) | cmp1a_ind; -sljit_emit_op_custom(compiler, instruction, 5); - -if (char1a != char1b) - { - instruction[3] = 0xc0 | (cmp1b_ind << 3) | cmp1b_ind; - sljit_emit_op_custom(compiler, instruction, 5); - } - -instruction[3] = 0xc0 | (cmp2a_ind << 3) | cmp2a_ind; -sljit_emit_op_custom(compiler, instruction, 5); - -if (char2a != char2b) - { - instruction[3] = 0xc0 | (cmp2b_ind << 3) | cmp2b_ind; - sljit_emit_op_custom(compiler, instruction, 5); - } - -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -restart = LABEL(); -#endif - -OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1 - offs2)); -OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); -OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf); -OP2(SLJIT_AND, TMP1, 0, TMP1, 0, SLJIT_IMM, ~0xf); - -load_from_mem_sse2(compiler, data1_ind, str_ptr_ind); - -jump[0] = CMP(SLJIT_EQUAL, STR_PTR, 0, TMP1, 0); - -load_from_mem_sse2(compiler, data2_ind, tmp1_ind); - -/* MOVDQA xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x6f; -instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -/* PSLLDQ xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x73; -instruction[3] = 0xc0 | (7 << 3) | tmp_ind; -instruction[4] = diff; -sljit_emit_op_custom(compiler, instruction, 5); - -/* PSRLDQ xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -/* instruction[2] = 0x73; */ -instruction[3] = 0xc0 | (3 << 3) | data2_ind; -instruction[4] = 16 - diff; -sljit_emit_op_custom(compiler, instruction, 5); - -/* POR xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xeb; -instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -jump[1] = JUMP(SLJIT_JUMP); - -JUMPHERE(jump[0]); - -/* MOVDQA xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x6f; -instruction[3] = 0xc0 | (data2_ind << 3) | data1_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -/* PSLLDQ xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x73; -instruction[3] = 0xc0 | (7 << 3) | data2_ind; -instruction[4] = diff; -sljit_emit_op_custom(compiler, instruction, 5); - -JUMPHERE(jump[1]); - -OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf); - -fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind); -fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind); - -/* PAND xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xdb; -instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -/* PMOVMSKB reg, xmm */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xd7; -instruction[3] = 0xc0 | (tmp1_ind << 3) | 0; -sljit_emit_op_custom(compiler, instruction, 4); - -/* Ignore matches before the first STR_PTR. */ -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0); -OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0); - -/* BSF r32, r/m32 */ -instruction[0] = 0x0f; -instruction[1] = 0xbc; -instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 3); -sljit_set_current_flags(compiler, SLJIT_SET_Z); - -jump[0] = JUMP(SLJIT_NOT_ZERO); - -OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); - -/* Main loop. */ -instruction[0] = 0x66; -instruction[1] = 0x0f; - -start = LABEL(); - -load_from_mem_sse2(compiler, data2_ind, str_ptr_ind); - -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16); -add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); - -load_from_mem_sse2(compiler, data1_ind, str_ptr_ind); - -/* PSRLDQ xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x73; -instruction[3] = 0xc0 | (3 << 3) | data2_ind; -instruction[4] = 16 - diff; -sljit_emit_op_custom(compiler, instruction, 5); - -/* MOVDQA xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x6f; -instruction[3] = 0xc0 | (tmp_ind << 3) | data1_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -/* PSLLDQ xmm1, xmm2/m128, imm8 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0x73; -instruction[3] = 0xc0 | (7 << 3) | tmp_ind; -instruction[4] = diff; -sljit_emit_op_custom(compiler, instruction, 5); - -/* POR xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xeb; -instruction[3] = 0xc0 | (data2_ind << 3) | tmp_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -fast_forward_char_pair_sse2_compare(compiler, char1a, char1b, bit1, data1_ind, cmp1a_ind, cmp1b_ind, tmp_ind); -fast_forward_char_pair_sse2_compare(compiler, char2a, char2b, bit2, data2_ind, cmp2a_ind, cmp2b_ind, tmp_ind); - -/* PAND xmm1, xmm2/m128 */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xdb; -instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind; -sljit_emit_op_custom(compiler, instruction, 4); - -/* PMOVMSKB reg, xmm */ -/* instruction[0] = 0x66; */ -/* instruction[1] = 0x0f; */ -instruction[2] = 0xd7; -instruction[3] = 0xc0 | (tmp1_ind << 3) | 0; -sljit_emit_op_custom(compiler, instruction, 4); - -/* BSF r32, r/m32 */ -instruction[0] = 0x0f; -instruction[1] = 0xbc; -instruction[2] = 0xc0 | (tmp1_ind << 3) | tmp1_ind; -sljit_emit_op_custom(compiler, instruction, 3); -sljit_set_current_flags(compiler, SLJIT_SET_Z); - -JUMPTO(SLJIT_ZERO, start); - -JUMPHERE(jump[0]); - -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); - -add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); - -if (common->match_end_ptr != 0) - OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); - -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -if (common->utf) - { - OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offs1)); - - jump[0] = jump_if_utf_char_start(compiler, TMP1); - - OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, restart); - - add_jump(compiler, &common->failed_match, JUMP(SLJIT_JUMP)); - - JUMPHERE(jump[0]); - } -#endif - -OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1)); - -if (common->match_end_ptr != 0) - OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); -} - -static BOOL check_fast_forward_char_pair_sse2(compiler_common *common, fast_forward_char_data *chars, int max) -{ -sljit_s32 i, j, priority, count; -sljit_u32 priorities; -PCRE2_UCHAR a1, a2, b1, b2; - -priorities = 0; - -count = 0; -for (i = 0; i < max; i++) - { - if (chars[i].last_count > 2) - { - SLJIT_ASSERT(chars[i].last_count <= 7); - - priorities |= (1 << chars[i].last_count); - count++; - } - } - -if (count < 2) - return FALSE; - -for (priority = 7; priority > 2; priority--) - { - if ((priorities & (1 << priority)) == 0) - continue; - - for (i = max - 1; i >= 1; i--) - if (chars[i].last_count >= priority) - { - SLJIT_ASSERT(chars[i].count <= 2 && chars[i].count >= 1); - - a1 = chars[i].chars[0]; - a2 = chars[i].chars[1]; - - j = i - max_fast_forward_char_pair_sse2_offset(); - if (j < 0) - j = 0; - - while (j < i) - { - if (chars[j].last_count >= priority) - { - b1 = chars[j].chars[0]; - b2 = chars[j].chars[1]; - - if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2) - { - fast_forward_char_pair_sse2(common, i, a1, a2, j, b1, b2); - return TRUE; - } - } - j++; - } - } - } - -return FALSE; -} - -#endif - -#undef SSE2_COMPARE_TYPE_INDEX - -#endif - -static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset) -{ -DEFINE_COMPILER; -struct sljit_label *start; -struct sljit_jump *match; -struct sljit_jump *partial_quit; -PCRE2_UCHAR mask; -BOOL has_match_end = (common->match_end_ptr != 0); - -SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE || offset == 0); - -if (has_match_end) - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); - -if (offset > 0) - OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset)); - -if (has_match_end) - { - OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - - OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offset + 1)); - OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0); - CMOV(SLJIT_GREATER, STR_END, TMP1, 0); - } - -#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) - -/* SSE2 accelerated first character search. */ - -if (sljit_has_cpu_feature(SLJIT_HAS_SSE2)) - { - fast_forward_first_char2_sse2(common, char1, char2, offset); - - if (offset > 0) - OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset)); - - if (has_match_end) - OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); - return; - } - -#endif - -start = LABEL(); - -partial_quit = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); -if (common->mode == PCRE2_JIT_COMPLETE) - add_jump(compiler, &common->failed_match, partial_quit); - -OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), 0); -OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - -if (char1 == char2) - CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1, start); -else - { - mask = char1 ^ char2; - if (is_powerof2(mask)) - { - OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, mask); - CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char1 | mask, start); - } - else - { - match = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, char1); - CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, char2, start); - JUMPHERE(match); - } - } - -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 -if (common->utf && offset > 0) - { - OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-(offset + 1))); - jumpto_if_not_utf_char_start(compiler, TMP1, start); - } -#endif - -OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offset + 1)); - -if (common->mode != PCRE2_JIT_COMPLETE) - JUMPHERE(partial_quit); - -if (has_match_end) - OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); -} - -static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *common) -{ -DEFINE_COMPILER; -struct sljit_label *start; -struct sljit_jump *match; -fast_forward_char_data chars[MAX_N_CHARS]; -sljit_s32 offset; -PCRE2_UCHAR mask; -PCRE2_UCHAR *char_set, *char_set_end; -int i, max, from; -int range_right = -1, range_len; -sljit_u8 *update_table = NULL; -BOOL in_range; -sljit_u32 rec_count; +struct sljit_jump *match; +fast_forward_char_data chars[MAX_N_CHARS]; +sljit_s32 offset; +PCRE2_UCHAR mask; +PCRE2_UCHAR *char_set, *char_set_end; +int i, max, from; +int range_right = -1, range_len; +sljit_u8 *update_table = NULL; +BOOL in_range; +sljit_u32 rec_count; for (i = 0; i < MAX_N_CHARS; i++) { @@ -6267,8 +5707,8 @@ for (i = 0; i < max; i++) chars[i].last_count = (chars[i].count == 255) ? 0 : 1; } -#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) && !(defined _WIN64) -if (sljit_has_cpu_feature(SLJIT_HAS_SSE2) && check_fast_forward_char_pair_sse2(common, chars, max)) +#ifdef JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD +if (JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD && check_fast_forward_char_pair_simd(common, chars, max)) return TRUE; #endif @@ -6353,18 +5793,21 @@ if (common->match_end_ptr != 0) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); - OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); + OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); + add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_END, 0, TMP1, 0); CMOV(SLJIT_GREATER, STR_END, TMP1, 0); } else - OP2(SLJIT_SUB, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); + { + OP2(SLJIT_SUB | SLJIT_SET_LESS, STR_END, 0, STR_END, 0, SLJIT_IMM, IN_UCHARS(max)); + add_jump(compiler, &common->failed_match, JUMP(SLJIT_LESS)); + } SLJIT_ASSERT(range_right >= 0); -#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) -OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table); -#endif +if (!HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, RETURN_ADDR, 0, SLJIT_IMM, (sljit_sw)update_table); start = LABEL(); add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER, STR_PTR, 0, STR_END, 0)); @@ -6375,11 +5818,11 @@ OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right)); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(range_right + 1) - 1); #endif -#if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) -OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0); -#else -OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table); -#endif +if (!HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM2(RETURN_ADDR, TMP1), 0); +else + OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)update_table); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0, start); @@ -6473,9 +5916,17 @@ if (common->match_end_ptr != 0) if (common->nltype == NLTYPE_FIXED && common->newline > 255) { lastchar = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + } + else + { + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str)); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); + } firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0); OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(2)); @@ -6503,9 +5954,15 @@ if (common->nltype == NLTYPE_FIXED && common->newline > 255) return; } -OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); +if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); + } +else + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str)); + /* Example: match /^/ to \r\n from offset 1. */ -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); firstchar = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0); move_back(common, NULL, FALSE); @@ -6586,7 +6043,7 @@ if (!optimize_class(common, start_bits, (start_bits[31] & 0x80) != 0, FALSE, &ma OP2(SLJIT_AND, TMP2, 0, TMP1, 0, SLJIT_IMM, 0x7); OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, SLJIT_IMM, 3); OP1(SLJIT_MOV_U8, TMP1, 0, SLJIT_MEM1(TMP1), (sljit_sw)start_bits); - if (sljit_get_register_index(TMP3) >= 0) + if (!HAS_VIRTUAL_REGISTERS) { OP2(SLJIT_SHL, TMP3, 0, SLJIT_IMM, 1, TMP2, 0); OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, TMP3, 0); @@ -6693,7 +6150,7 @@ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), -sizeof(sljit_sw)); jump = CMP(SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0); OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); -if (sljit_get_register_index(TMP3) < 0) +if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw))); OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), sizeof(sljit_sw), SLJIT_MEM1(STACK_TOP), -(3 * sizeof(sljit_sw))); @@ -6718,7 +6175,7 @@ sljit_emit_fast_return(compiler, RETURN_ADDR, 0); JUMPHERE(jump); OP1(SLJIT_NEG, TMP2, 0, TMP2, 0); OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); -if (sljit_get_register_index(TMP3) < 0) +if (HAS_VIRTUAL_REGISTERS) { OP1(SLJIT_MOV, SLJIT_MEM1(TMP2), 0, SLJIT_MEM1(STACK_TOP), -(2 * sizeof(sljit_sw))); OP2(SLJIT_SUB, STACK_TOP, 0, STACK_TOP, 0, SLJIT_IMM, 2 * sizeof(sljit_sw)); @@ -6737,7 +6194,11 @@ static void check_wordboundary(compiler_common *common) DEFINE_COMPILER; struct sljit_jump *skipread; jump_list *skipread_list = NULL; -jump_list *invalid_utf = NULL; +#ifdef SUPPORT_UNICODE +struct sljit_label *valid_utf; +jump_list *invalid_utf1 = NULL; +#endif /* SUPPORT_UNICODE */ +jump_list *invalid_utf2 = NULL; #if PCRE2_CODE_UNIT_WIDTH != 8 || defined SUPPORT_UNICODE struct sljit_jump *jump; #endif /* PCRE2_CODE_UNIT_WIDTH != 8 || SUPPORT_UNICODE */ @@ -6751,14 +6212,30 @@ OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, 0); skipread = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0); -if (common->mode == PCRE2_JIT_COMPLETE) - peek_char_back(common, READ_CHAR_MAX, &invalid_utf); +#ifdef SUPPORT_UNICODE +if (common->invalid_utf) + { + peek_char_back(common, READ_CHAR_MAX, &invalid_utf1); + + if (common->mode != PCRE2_JIT_COMPLETE) + { + OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); + move_back(common, NULL, TRUE); + check_start_used_ptr(common); + OP1(SLJIT_MOV, STR_PTR, 0, TMP2, 0); + } + } else +#endif /* SUPPORT_UNICODE */ { - move_back(common, &invalid_utf, FALSE); - check_start_used_ptr(common); - /* No need precise read since match fails anyway. */ - read_char(common, 0, READ_CHAR_MAX, &invalid_utf, READ_CHAR_UPDATE_STR_PTR); + if (common->mode == PCRE2_JIT_COMPLETE) + peek_char_back(common, READ_CHAR_MAX, NULL); + else + { + move_back(common, NULL, TRUE); + check_start_used_ptr(common); + read_char(common, 0, READ_CHAR_MAX, NULL, READ_CHAR_UPDATE_STR_PTR); + } } /* Testing char type. */ @@ -6802,10 +6279,13 @@ JUMPHERE(skipread); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0); check_str_end(common, &skipread_list); -peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, &invalid_utf); +peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, &invalid_utf2); /* Testing char type. This is a code duplication. */ #ifdef SUPPORT_UNICODE + +valid_utf = LABEL(); + if (common->use_ucp) { OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1); @@ -6851,13 +6331,19 @@ sljit_emit_fast_return(compiler, TMP1, 0); #ifdef SUPPORT_UNICODE if (common->invalid_utf) { - SLJIT_ASSERT(invalid_utf != NULL); + set_jumps(invalid_utf1, LABEL()); + + peek_char(common, READ_CHAR_MAX, SLJIT_MEM1(SLJIT_SP), LOCALS1, NULL); + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, INVALID_UTF_CHAR, valid_utf); - set_jumps(invalid_utf, LABEL()); OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, -1); sljit_emit_fast_return(compiler, TMP1, 0); - return; + + set_jumps(invalid_utf2, LABEL()); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); + OP1(SLJIT_MOV, TMP2, 0, TMP3, 0); + sljit_emit_fast_return(compiler, TMP1, 0); } #endif /* SUPPORT_UNICODE */ } @@ -7225,7 +6711,7 @@ struct sljit_label *label; int char1_reg; int char2_reg; -if (sljit_get_register_index(TMP3) < 0) +if (HAS_VIRTUAL_REGISTERS) { char1_reg = STR_END; char2_reg = STACK_TOP; @@ -7307,7 +6793,7 @@ int char2_reg; int lcc_table; int opt_type = 0; -if (sljit_get_register_index(TMP3) < 0) +if (HAS_VIRTUAL_REGISTERS) { char2_reg = STACK_TOP; lcc_table = STACK_LIMIT; @@ -7790,8 +7276,6 @@ if (needstype || needsscript) if (needsscript) { // PH hacking -//fprintf(stderr, "~~B\n"); - OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3); OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); @@ -7845,7 +7329,6 @@ if (needstype || needsscript) if (!needschar) { // PH hacking -//fprintf(stderr, "~~C\n"); OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3); OP2(SLJIT_ADD, TMP2, 0, TMP2, 0, TMP1, 0); @@ -7860,7 +7343,6 @@ if (needstype || needsscript) else { // PH hacking -//fprintf(stderr, "~~D\n"); OP2(SLJIT_SHL, TMP1, 0, TMP2, 0, SLJIT_IMM, 2); OP2(SLJIT_SHL, TMP2, 0, TMP2, 0, SLJIT_IMM, 3); @@ -8174,14 +7656,24 @@ struct sljit_label *label; switch(type) { case OP_SOD: - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + } + else + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0)); return cc; case OP_SOM: - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); + } + else + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str)); add_jump(compiler, backtracks, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, TMP1, 0)); return cc; @@ -8191,9 +7683,7 @@ switch(type) #ifdef SUPPORT_UNICODE if (common->invalid_utf) { - OP2(SLJIT_SUB | SLJIT_SET_Z | SLJIT_SET_SIG_LESS, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, 0); - add_jump(compiler, backtracks, JUMP(SLJIT_SIG_LESS)); - add_jump(compiler, backtracks, JUMP(type == OP_NOT_WORD_BOUNDARY ? SLJIT_NOT_ZERO : SLJIT_ZERO)); + add_jump(compiler, backtracks, CMP((type == OP_NOT_WORD_BOUNDARY) ? SLJIT_NOT_EQUAL : SLJIT_SIG_LESS_EQUAL, TMP2, 0, SLJIT_IMM, 0)); return cc; } #endif /* SUPPORT_UNICODE */ @@ -8267,17 +7757,24 @@ switch(type) JUMPHERE(jump[3]); } JUMPHERE(jump[0]); - check_partial(common, FALSE); + if (common->mode != PCRE2_JIT_COMPLETE) + check_partial(common, TRUE); return cc; case OP_EOD: add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0)); - check_partial(common, FALSE); + if (common->mode != PCRE2_JIT_COMPLETE) + check_partial(common, TRUE); return cc; case OP_DOLL: - OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); - OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); + } + else + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); if (!common->endonly) @@ -8291,8 +7788,13 @@ switch(type) case OP_DOLLM: jump[1] = CMP(SLJIT_LESS, STR_PTR, 0, STR_END, 0); - OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); - OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); + } + else + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL); add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); check_partial(common, FALSE); jump[0] = JUMP(SLJIT_JUMP); @@ -8327,18 +7829,38 @@ switch(type) return cc; case OP_CIRC: - OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin)); - add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0)); - OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); - add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP2, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin)); + add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0)); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); + add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); + } + else + { + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); + add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0)); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); + add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); + } return cc; case OP_CIRCM: - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); - jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0); - OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); + /* TMP2 might be used by peek_char_back. */ + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); + } + else + { + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); + jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0); + OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL); + } add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32)); jump[0] = JUMP(SLJIT_JUMP); JUMPHERE(jump[1]); @@ -8367,11 +7889,16 @@ switch(type) length = GET(cc, 0); if (length == 0) return cc + LINK_SIZE; - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); + } + else + OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin)); #ifdef SUPPORT_UNICODE if (common->utf) { - OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); OP1(SLJIT_MOV, TMP3, 0, SLJIT_IMM, length); label = LABEL(); add_jump(compiler, backtracks, CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, TMP2, 0)); @@ -8382,9 +7909,8 @@ switch(type) else #endif { - OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, begin)); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(length)); - add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP1, 0)); + add_jump(compiler, backtracks, CMP(SLJIT_LESS, STR_PTR, 0, TMP2, 0)); } check_start_used_ptr(common); return cc + LINK_SIZE; @@ -8402,12 +7928,12 @@ static PCRE2_SPTR SLJIT_FUNC do_extuni_utf(jit_arguments *args, PCRE2_SPTR cc) PCRE2_SPTR start_subject = args->begin; PCRE2_SPTR end_subject = args->end; int lgb, rgb, ricount; -PCRE2_SPTR prevcc, startcc, bptr; +PCRE2_SPTR prevcc, endcc, bptr; BOOL first = TRUE; uint32_t c; prevcc = cc; -startcc = NULL; +endcc = NULL; do { GETCHARINC(c, cc); @@ -8416,7 +7942,7 @@ do if (first) { lgb = rgb; - startcc = cc; + endcc = cc; first = FALSE; continue; } @@ -8455,25 +7981,27 @@ do lgb != ucp_gbExtended_Pictographic) lgb = rgb; - prevcc = startcc; - startcc = cc; + prevcc = endcc; + endcc = cc; } while (cc < end_subject); -return startcc; +return endcc; } +#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */ + static PCRE2_SPTR SLJIT_FUNC do_extuni_utf_invalid(jit_arguments *args, PCRE2_SPTR cc) { PCRE2_SPTR start_subject = args->begin; PCRE2_SPTR end_subject = args->end; int lgb, rgb, ricount; -PCRE2_SPTR prevcc, startcc, bptr; +PCRE2_SPTR prevcc, endcc, bptr; BOOL first = TRUE; uint32_t c; prevcc = cc; -startcc = NULL; +endcc = NULL; do { GETCHARINC_INVALID(c, cc, end_subject, break); @@ -8482,7 +8010,7 @@ do if (first) { lgb = rgb; - startcc = cc; + endcc = cc; first = FALSE; continue; } @@ -8520,16 +8048,14 @@ do lgb != ucp_gbExtended_Pictographic) lgb = rgb; - prevcc = startcc; - startcc = cc; + prevcc = endcc; + endcc = cc; } while (cc < end_subject); -return startcc; +return endcc; } -#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */ - static PCRE2_SPTR SLJIT_FUNC do_extuni_no_utf(jit_arguments *args, PCRE2_SPTR cc) { PCRE2_SPTR start_subject = args->begin; @@ -8538,7 +8064,10 @@ int lgb, rgb, ricount; PCRE2_SPTR bptr; uint32_t c; -GETCHARINC(c, cc); +/* Patch by PH */ +/* GETCHARINC(c, cc); */ +c = *cc++; + #if PCRE2_CODE_UNIT_WIDTH == 32 if (c >= 0x110000) return NULL; @@ -8800,8 +8329,10 @@ switch(type) if (common->invalid_utf) add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0)); #else - sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, SLJIT_FUNC_OFFSET(do_extuni_no_utf)); - add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0)); + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW), SLJIT_IMM, + common->invalid_utf ? SLJIT_FUNC_OFFSET(do_extuni_utf_invalid) : SLJIT_FUNC_OFFSET(do_extuni_no_utf)); + if (!common->utf || common->invalid_utf) + add_jump(compiler, backtracks, CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0)); #endif OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0); @@ -9198,8 +8729,6 @@ if (common->utf && *cc == OP_REFI) CMPTO(SLJIT_EQUAL, TMP1, 0, char1_reg, 0, loop); // PH hacking -//fprintf(stderr, "~~E\n"); - OP1(SLJIT_MOV, TMP3, 0, TMP1, 0); add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL)); @@ -10759,10 +10288,23 @@ if (ket != OP_KET || bra != OP_BRA) if (offset != 0) stacksize = match_capture_common(common, stacksize, offset, private_data_ptr); +/* Skip and count the other alternatives. */ +i = 1; +while (*cc == OP_ALT) + { + cc += GET(cc, 1); + i++; + } + if (has_alternatives) { if (opcode != OP_ONCE) - OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, 0); + { + if (i <= 3) + OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, 0); + else + BACKTRACK_AS(bracket_backtrack)->u.matching_put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(stacksize)); + } if (ket != OP_KETRMAX) BACKTRACK_AS(bracket_backtrack)->alternative_matchingpath = LABEL(); } @@ -10851,9 +10393,6 @@ if (bra == OP_BRAMINZERO) if ((ket != OP_KET && bra != OP_BRAMINZERO) || bra == OP_BRAZERO) count_match(common); -/* Skip the other alternatives. */ -while (*cc == OP_ALT) - cc += GET(cc, 1); cc += 1 + LINK_SIZE; if (opcode == OP_ONCE) @@ -11412,174 +10951,232 @@ switch(opcode) JUMPTO(SLJIT_JUMP, label); if (jump != NULL) JUMPHERE(jump); + BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); + break; } - else +#ifdef SUPPORT_UNICODE + else if (type == OP_ALLANY && !common->invalid_utf) +#else + else if (type == OP_ALLANY) +#endif { - charpos_enabled = FALSE; - charpos_char = 0; - charpos_othercasebit = 0; + if (opcode == OP_STAR) + { + if (private_data_ptr == 0) + allocate_stack(common, 2); + + OP1(SLJIT_MOV, base, offset0, STR_END, 0); + OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); + + OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0); + process_partial_match(common); - if ((type != OP_CHAR && type != OP_CHARI) && (*end == OP_CHAR || *end == OP_CHARI)) + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_END, 0); + BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); + break; + } +#ifdef SUPPORT_UNICODE + else if (!common->utf) +#else + else +#endif { - charpos_enabled = TRUE; + if (private_data_ptr == 0) + allocate_stack(common, 2); + + OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max)); + + if (common->mode == PCRE2_JIT_COMPLETE) + { + OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0); + CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); + } + else + { + jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0); + process_partial_match(common); + JUMPHERE(jump); + } + + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); + break; + } + } + + charpos_enabled = FALSE; + charpos_char = 0; + charpos_othercasebit = 0; + + if ((type != OP_CHAR && type != OP_CHARI) && (*end == OP_CHAR || *end == OP_CHARI)) + { #ifdef SUPPORT_UNICODE - charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]); + charpos_enabled = !common->utf || !HAS_EXTRALEN(end[1]); +#else + charpos_enabled = TRUE; #endif - if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1)) - { - charpos_othercasebit = char_get_othercase_bit(common, end + 1); - if (charpos_othercasebit == 0) - charpos_enabled = FALSE; - } + if (charpos_enabled && *end == OP_CHARI && char_has_othercase(common, end + 1)) + { + charpos_othercasebit = char_get_othercase_bit(common, end + 1); + if (charpos_othercasebit == 0) + charpos_enabled = FALSE; + } - if (charpos_enabled) - { - charpos_char = end[1]; - /* Consumpe the OP_CHAR opcode. */ - end += 2; + if (charpos_enabled) + { + charpos_char = end[1]; + /* Consumpe the OP_CHAR opcode. */ + end += 2; #if PCRE2_CODE_UNIT_WIDTH == 8 - SLJIT_ASSERT((charpos_othercasebit >> 8) == 0); + SLJIT_ASSERT((charpos_othercasebit >> 8) == 0); #elif PCRE2_CODE_UNIT_WIDTH == 16 || PCRE2_CODE_UNIT_WIDTH == 32 - SLJIT_ASSERT((charpos_othercasebit >> 9) == 0); - if ((charpos_othercasebit & 0x100) != 0) - charpos_othercasebit = (charpos_othercasebit & 0xff) << 8; + SLJIT_ASSERT((charpos_othercasebit >> 9) == 0); + if ((charpos_othercasebit & 0x100) != 0) + charpos_othercasebit = (charpos_othercasebit & 0xff) << 8; #endif - if (charpos_othercasebit != 0) - charpos_char |= charpos_othercasebit; + if (charpos_othercasebit != 0) + charpos_char |= charpos_othercasebit; - BACKTRACK_AS(char_iterator_backtrack)->u.charpos.enabled = TRUE; - BACKTRACK_AS(char_iterator_backtrack)->u.charpos.chr = charpos_char; - BACKTRACK_AS(char_iterator_backtrack)->u.charpos.othercasebit = charpos_othercasebit; - } + BACKTRACK_AS(char_iterator_backtrack)->u.charpos.enabled = TRUE; + BACKTRACK_AS(char_iterator_backtrack)->u.charpos.chr = charpos_char; + BACKTRACK_AS(char_iterator_backtrack)->u.charpos.othercasebit = charpos_othercasebit; } + } - if (charpos_enabled) + if (charpos_enabled) + { + if (opcode == OP_UPTO) + OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max + 1); + + /* Search the first instance of charpos_char. */ + jump = JUMP(SLJIT_JUMP); + label = LABEL(); + if (opcode == OP_UPTO) { - if (opcode == OP_UPTO) - OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max + 1); + OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); + add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO)); + } + compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + JUMPHERE(jump); - /* Search the first instance of charpos_char. */ - jump = JUMP(SLJIT_JUMP); - label = LABEL(); - if (opcode == OP_UPTO) - { - OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_ZERO)); - } - compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE); - if (fast_str_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); - JUMPHERE(jump); + detect_partial_match(common, &backtrack->topbacktracks); + OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); + if (charpos_othercasebit != 0) + OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); - detect_partial_match(common, &backtrack->topbacktracks); - OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); - if (charpos_othercasebit != 0) - OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); - CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); + if (private_data_ptr == 0) + allocate_stack(common, 2); + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); + if (opcode == OP_UPTO) + { + OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); + add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); + } - if (private_data_ptr == 0) - allocate_stack(common, 2); + /* Search the last instance of charpos_char. */ + label = LABEL(); + compile_char1_matchingpath(common, type, cc, &no_match, FALSE); + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + detect_partial_match(common, &no_match); + OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); + if (charpos_othercasebit != 0) + OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); + if (opcode == OP_STAR) + { + CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); - if (opcode == OP_UPTO) - { - OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); - } - - /* Search the last instance of charpos_char. */ - label = LABEL(); - compile_char1_matchingpath(common, type, cc, &no_match, FALSE); - if (fast_str_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); - detect_partial_match(common, &no_match); - OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(0)); - if (charpos_othercasebit != 0) - OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, charpos_othercasebit); - if (opcode == OP_STAR) - { - CMPTO(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char, label); - OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - } - else - { - jump = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char); - OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - JUMPHERE(jump); - } - - if (opcode == OP_UPTO) - { - OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - JUMPTO(SLJIT_NOT_ZERO, label); - } - else - JUMPTO(SLJIT_JUMP, label); - - set_jumps(no_match, LABEL()); - OP1(SLJIT_MOV, STR_PTR, 0, base, offset0); - OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + } + else + { + jump = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, charpos_char); OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + JUMPHERE(jump); } -#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 - else if (common->utf) + + if (opcode == OP_UPTO) { - if (private_data_ptr == 0) - allocate_stack(common, 2); + OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); + JUMPTO(SLJIT_NOT_ZERO, label); + } + else + JUMPTO(SLJIT_JUMP, label); - OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); + set_jumps(no_match, LABEL()); + OP1(SLJIT_MOV, STR_PTR, 0, base, offset0); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + } +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + else if (common->utf) + { + if (private_data_ptr == 0) + allocate_stack(common, 2); - if (opcode == OP_UPTO) - OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); - label = LABEL(); - compile_char1_matchingpath(common, type, cc, &no_match, TRUE); - OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + if (opcode == OP_UPTO) + OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); - if (opcode == OP_UPTO) - { - OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - JUMPTO(SLJIT_NOT_ZERO, label); - } - else - JUMPTO(SLJIT_JUMP, label); + detect_partial_match(common, &no_match); + label = LABEL(); + compile_char1_matchingpath(common, type, cc, &no_match, FALSE); + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - set_jumps(no_match, LABEL()); - OP1(SLJIT_MOV, STR_PTR, 0, base, offset0); - if (fast_str_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); - } -#endif - else + if (opcode == OP_UPTO) { - if (private_data_ptr == 0) - allocate_stack(common, 2); + OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); + add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); + } - OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); - if (opcode == OP_UPTO) - OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); + detect_partial_match_to(common, label); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - label = LABEL(); - detect_partial_match(common, &no_match); - compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); - if (opcode == OP_UPTO) - { - OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - JUMPTO(SLJIT_NOT_ZERO, label); - OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - } - else - JUMPTO(SLJIT_JUMP, label); + set_jumps(no_match, LABEL()); + OP1(SLJIT_MOV, STR_PTR, 0, base, offset0); + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + } +#endif + else + { + if (private_data_ptr == 0) + allocate_stack(common, 2); - set_jumps(no_char1_match, LABEL()); - OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); - set_jumps(no_match, LABEL()); - OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); - if (fast_str_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + OP1(SLJIT_MOV, base, offset1, STR_PTR, 0); + if (opcode == OP_UPTO) + OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); + + detect_partial_match(common, &no_match); + label = LABEL(); + compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); + if (opcode == OP_UPTO) + { + OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); + add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); } + + detect_partial_match_to(common, label); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + + set_jumps(no_char1_match, LABEL()); + OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + set_jumps(no_match, LABEL()); + OP1(SLJIT_MOV, base, offset0, STR_PTR, 0); + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); } + BACKTRACK_AS(char_iterator_backtrack)->matchingpath = LABEL(); break; @@ -11616,25 +11213,47 @@ switch(opcode) break; case OP_POSSTAR: +#if defined SUPPORT_UNICODE + if (type == OP_ALLANY && !common->invalid_utf) +#else + if (type == OP_ALLANY) +#endif + { + OP1(SLJIT_MOV, STR_PTR, 0, STR_END, 0); + process_partial_match(common); + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_END, 0); + break; + } + #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 if (common->utf) { OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); + detect_partial_match(common, &no_match); label = LABEL(); - compile_char1_matchingpath(common, type, cc, &no_match, TRUE); + compile_char1_matchingpath(common, type, cc, &no_match, FALSE); OP1(SLJIT_MOV, tmp_base, tmp_offset, STR_PTR, 0); - JUMPTO(SLJIT_JUMP, label); + detect_partial_match_to(common, label); + set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, STR_PTR, 0, tmp_base, tmp_offset); if (fast_str_ptr != 0) - OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + { + if (tmp_base == TMP3) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, TMP3, 0); + else + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + } break; } #endif - label = LABEL(); detect_partial_match(common, &no_match); + label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); - JUMPTO(SLJIT_JUMP, label); + detect_partial_match_to(common, label); + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + set_jumps(no_char1_match, LABEL()); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_match, LABEL()); @@ -11649,23 +11268,52 @@ switch(opcode) { OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0); OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); + + detect_partial_match(common, &no_match); label = LABEL(); - compile_char1_matchingpath(common, type, cc, &no_match, TRUE); + compile_char1_matchingpath(common, type, cc, &no_match, FALSE); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1, STR_PTR, 0); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - JUMPTO(SLJIT_NOT_ZERO, label); + add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); + detect_partial_match_to(common, label); + set_jumps(no_match, LABEL()); OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), POSSESSIVE1); break; } #endif + + if (type == OP_ALLANY) + { + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(max)); + + if (common->mode == PCRE2_JIT_COMPLETE) + { + OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0); + CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); + } + else + { + jump = CMP(SLJIT_LESS_EQUAL, STR_PTR, 0, STR_END, 0); + process_partial_match(common); + JUMPHERE(jump); + } + + if (fast_str_ptr != 0) + OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), fast_str_ptr, STR_PTR, 0); + break; + } + OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, max); - label = LABEL(); + detect_partial_match(common, &no_match); + label = LABEL(); compile_char1_matchingpath(common, type, cc, &no_char1_match, FALSE); OP2(SLJIT_SUB | SLJIT_SET_Z, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1); - JUMPTO(SLJIT_NOT_ZERO, label); + add_jump(compiler, &no_match, JUMP(SLJIT_ZERO)); + detect_partial_match_to(common, label); OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + set_jumps(no_char1_match, LABEL()); OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); set_jumps(no_match, LABEL()); @@ -11719,8 +11367,15 @@ if (common->accept_label == NULL) add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0))); else CMPTO(SLJIT_NOT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0), common->accept_label); -OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); -OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options)); + +if (HAS_VIRTUAL_REGISTERS) + { + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, options)); + } +else + OP1(SLJIT_MOV_U32, TMP2, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options)); + OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY); add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_NOT_ZERO)); OP2(SLJIT_AND | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP2, 0, SLJIT_IMM, PCRE2_NOTEMPTY_ATSTART); @@ -11728,7 +11383,8 @@ if (common->accept_label == NULL) add_jump(compiler, &common->accept, JUMP(SLJIT_ZERO)); else JUMPTO(SLJIT_ZERO, common->accept_label); -OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, str)); + +OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, str)); if (common->accept_label == NULL) add_jump(compiler, &common->accept, CMP(SLJIT_NOT_EQUAL, TMP2, 0, STR_PTR, 0)); else @@ -11778,10 +11434,11 @@ if (opcode == OP_SKIP) if (opcode == OP_COMMIT_ARG || opcode == OP_PRUNE_ARG || opcode == OP_THEN_ARG) { - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + if (HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); } return ccend; @@ -12072,11 +11729,12 @@ while (cc < ccend) SLJIT_ASSERT(common->mark_ptr != 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->mark_ptr); allocate_stack(common, common->has_skip_arg ? 5 : 1); - OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); + if (HAS_VIRTUAL_REGISTERS) + OP1(SLJIT_MOV, TMP1, 0, ARGUMENTS, 0); OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(common->has_skip_arg ? 4 : 0), TMP2, 0); OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, (sljit_sw)(cc + 2)); OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), common->mark_ptr, TMP2, 0); - OP1(SLJIT_MOV, SLJIT_MEM1(TMP1), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); + OP1(SLJIT_MOV, SLJIT_MEM1(HAS_VIRTUAL_REGISTERS ? TMP1 : ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, mark_ptr), TMP2, 0); if (common->has_skip_arg) { OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->control_head_ptr); @@ -12403,16 +12061,15 @@ PCRE2_SPTR ccprev; PCRE2_UCHAR bra = OP_BRA; PCRE2_UCHAR ket; assert_backtrack *assert; -sljit_uw *next_update_addr = NULL; BOOL has_alternatives; BOOL needs_control_head = FALSE; struct sljit_jump *brazero = NULL; -struct sljit_jump *alt1 = NULL; -struct sljit_jump *alt2 = NULL; +struct sljit_jump *next_alt = NULL; struct sljit_jump *once = NULL; struct sljit_jump *cond = NULL; struct sljit_label *rmin_label = NULL; struct sljit_label *exact_label = NULL; +struct sljit_put_label *put_label = NULL; if (*cc == OP_BRAZERO || *cc == OP_BRAMINZERO) { @@ -12561,7 +12218,7 @@ else if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND) free_stack(common, 1); alt_max = 2; - alt1 = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw)); + next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0); } } else if (has_alternatives) @@ -12569,21 +12226,15 @@ else if (has_alternatives) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); free_stack(common, 1); - if (alt_max > 4) + if (alt_max > 3) { - /* Table jump if alt_max is greater than 4. */ - next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw)); - if (SLJIT_UNLIKELY(next_update_addr == NULL)) - return; - sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr); - add_label_addr(common, next_update_addr++); + sljit_emit_ijump(compiler, SLJIT_JUMP, TMP1, 0); + + SLJIT_ASSERT(CURRENT_AS(bracket_backtrack)->u.matching_put_label); + sljit_set_put_label(CURRENT_AS(bracket_backtrack)->u.matching_put_label, LABEL()); } else - { - if (alt_max == 4) - alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw)); - alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw)); - } + next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0); } COMPILE_BACKTRACKINGPATH(current->top); @@ -12620,7 +12271,7 @@ if (SLJIT_UNLIKELY(opcode == OP_COND) || SLJIT_UNLIKELY(opcode == OP_SCOND)) if (has_alternatives) { - alt_count = sizeof(sljit_uw); + alt_count = 1; do { current->top = NULL; @@ -12699,7 +12350,12 @@ if (has_alternatives) stacksize = match_capture_common(common, stacksize, offset, private_data_ptr); if (opcode != OP_ONCE) - OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, alt_count); + { + if (alt_max <= 3) + OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(stacksize), SLJIT_IMM, alt_count); + else + put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(stacksize)); + } if (offset != 0 && ket == OP_KETRMAX && common->optimized_cbracket[offset >> 1] != 0) { @@ -12712,24 +12368,18 @@ if (has_alternatives) if (opcode != OP_ONCE) { - if (alt_max > 4) - add_label_addr(common, next_update_addr++); - else + if (alt_max <= 3) { - if (alt_count != 2 * sizeof(sljit_uw)) - { - JUMPHERE(alt1); - if (alt_max == 3 && alt_count == sizeof(sljit_uw)) - alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw)); - } - else + JUMPHERE(next_alt); + alt_count++; + if (alt_count < alt_max) { - JUMPHERE(alt2); - if (alt_max == 4) - alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw)); + SLJIT_ASSERT(alt_count == 2 && alt_max == 3); + next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 1); } } - alt_count += sizeof(sljit_uw); + else + sljit_set_put_label(put_label, LABEL()); } COMPILE_BACKTRACKINGPATH(current->top); @@ -13219,11 +12869,10 @@ int private_data_size = get_recurse_data_length(common, ccbegin, ccend, &needs_c int alt_count, alt_max, local_size; backtrack_common altbacktrack; jump_list *match = NULL; -sljit_uw *next_update_addr = NULL; -struct sljit_jump *alt1 = NULL; -struct sljit_jump *alt2 = NULL; +struct sljit_jump *next_alt = NULL; struct sljit_jump *accept_exit = NULL; struct sljit_label *quit; +struct sljit_put_label *put_label; /* Recurse captures then. */ common->then_trap = NULL; @@ -13284,7 +12933,12 @@ while (1) OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(SLJIT_SP), common->recursive_head_ptr); if (alt_max > 1 || has_accept) - OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count); + { + if (alt_max > 3) + put_label = sljit_emit_put_label(compiler, SLJIT_MEM1(STACK_TOP), STACK(1)); + else + OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count); + } add_jump(compiler, &match, JUMP(SLJIT_JUMP)); @@ -13298,7 +12952,7 @@ while (1) sljit_emit_fast_enter(compiler, TMP1, 0); if (has_accept) - accept_exit = CMP(SLJIT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_max * sizeof (sljit_sw)); + accept_exit = CMP(SLJIT_EQUAL, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, -1); OP1(SLJIT_MOV, TMP2, 0, SLJIT_MEM1(STACK_TOP), STACK(0)); /* Save return address. */ @@ -13311,44 +12965,30 @@ while (1) OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(STACK_TOP), STACK(1)); free_stack(common, 2); - if (alt_max > 4) + if (alt_max > 3) { - /* Table jump if alt_max is greater than 4. */ - next_update_addr = allocate_read_only_data(common, alt_max * sizeof(sljit_uw)); - if (SLJIT_UNLIKELY(next_update_addr == NULL)) - return; - sljit_emit_ijump(compiler, SLJIT_JUMP, SLJIT_MEM1(TMP1), (sljit_sw)next_update_addr); - add_label_addr(common, next_update_addr++); + sljit_emit_ijump(compiler, SLJIT_JUMP, TMP1, 0); + sljit_set_put_label(put_label, LABEL()); } else - { - if (alt_max == 4) - alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw)); - alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, sizeof(sljit_uw)); - } + next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 0); } else free_stack(common, has_accept ? 2 : 1); } - else if (alt_max > 4) - add_label_addr(common, next_update_addr++); + else if (alt_max > 3) + sljit_set_put_label(put_label, LABEL()); else { - if (alt_count != 2 * sizeof(sljit_uw)) + JUMPHERE(next_alt); + if (alt_count + 1 < alt_max) { - JUMPHERE(alt1); - if (alt_max == 3 && alt_count == sizeof(sljit_uw)) - alt2 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 2 * sizeof(sljit_uw)); - } - else - { - JUMPHERE(alt2); - if (alt_max == 4) - alt1 = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 3 * sizeof(sljit_uw)); + SLJIT_ASSERT(alt_count == 1 && alt_max == 3); + next_alt = CMP(SLJIT_NOT_EQUAL, TMP1, 0, SLJIT_IMM, 1); } } - alt_count += sizeof(sljit_uw); + alt_count++; compile_backtrackingpath(common, altbacktrack.top); if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) @@ -13409,7 +13049,7 @@ if (common->accept != NULL) OP1(SLJIT_MOV, TMP2, 0, STACK_TOP, 0); allocate_stack(common, 2); - OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, alt_count); + OP1(SLJIT_MOV, SLJIT_MEM1(STACK_TOP), STACK(1), SLJIT_IMM, -1); } set_jumps(match, LABEL()); @@ -13444,7 +13084,6 @@ executable_functions *functions; void *executable_func; sljit_uw executable_size; sljit_uw total_length; -label_addr_list *label_addr; struct sljit_label *mainloop_label = NULL; struct sljit_label *continue_match_label; struct sljit_label *empty_match_found_label = NULL; @@ -13459,6 +13098,14 @@ struct sljit_jump *end_anchor_failed = NULL; SLJIT_ASSERT(tables); +#if HAS_VIRTUAL_REGISTERS == 1 +SLJIT_ASSERT(sljit_get_register_index(TMP3) < 0 && sljit_get_register_index(ARGUMENTS) < 0 && sljit_get_register_index(RETURN_ADDR) < 0); +#elif HAS_VIRTUAL_REGISTERS == 0 +SLJIT_ASSERT(sljit_get_register_index(TMP3) >= 0 && sljit_get_register_index(ARGUMENTS) >= 0 && sljit_get_register_index(RETURN_ADDR) >= 0); +#else +#error "Invalid value for HAS_VIRTUAL_REGISTERS" +#endif + memset(&rootbacktrack, 0, sizeof(backtrack_common)); memset(common, 0, sizeof(compiler_common)); common->re = re; @@ -13476,6 +13123,7 @@ common->fcc = tables + fcc_offset; common->lcc = (sljit_sw)(tables + lcc_offset); common->mode = mode; common->might_be_empty = re->minlength == 0; +common->allow_empty_partial = (re->max_lookbehind > 0) || (re->flags & PCRE2_MATCH_EMPTY) != 0; common->nltype = NLTYPE_FIXED; switch(re->newline_convention) { @@ -13742,7 +13390,7 @@ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) sljit_free_compiler(compiler); SLJIT_FREE(common->optimized_cbracket, allocator_data); SLJIT_FREE(common->private_data_ptrs, allocator_data); - PRIV(jit_free_rodata)(common->read_only_data_head, compiler->allocator_data); + PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); return PCRE2_ERROR_NOMEMORY; } @@ -13796,7 +13444,7 @@ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler))) sljit_free_compiler(compiler); SLJIT_FREE(common->optimized_cbracket, allocator_data); SLJIT_FREE(common->private_data_ptrs, allocator_data); - PRIV(jit_free_rodata)(common->read_only_data_head, compiler->allocator_data); + PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); return PCRE2_ERROR_NOMEMORY; } @@ -13885,7 +13533,7 @@ while (common->currententry != NULL) sljit_free_compiler(compiler); SLJIT_FREE(common->optimized_cbracket, allocator_data); SLJIT_FREE(common->private_data_ptrs, allocator_data); - PRIV(jit_free_rodata)(common->read_only_data_head, compiler->allocator_data); + PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); return PCRE2_ERROR_NOMEMORY; } flush_stubs(common); @@ -14028,16 +13676,11 @@ SLJIT_FREE(common->private_data_ptrs, allocator_data); executable_func = sljit_generate_code(compiler); executable_size = sljit_get_generated_code_size(compiler); -label_addr = common->label_addrs; -while (label_addr != NULL) - { - *label_addr->update_addr = sljit_get_label_addr(label_addr->label); - label_addr = label_addr->next; - } sljit_free_compiler(compiler); + if (executable_func == NULL) { - PRIV(jit_free_rodata)(common->read_only_data_head, compiler->allocator_data); + PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); return PCRE2_ERROR_NOMEMORY; } @@ -14052,7 +13695,7 @@ else /* This case is highly unlikely since we just recently freed a lot of memory. Not impossible though. */ sljit_free_code(executable_func); - PRIV(jit_free_rodata)(common->read_only_data_head, compiler->allocator_data); + PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data); return PCRE2_ERROR_NOMEMORY; } memset(functions, 0, sizeof(executable_functions)); @@ -14097,18 +13740,12 @@ Returns: 0: success or (*NOJIT) was used PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_jit_compile(pcre2_code *code, uint32_t options) { -#ifndef SUPPORT_JIT - -(void)code; -(void)options; -return PCRE2_ERROR_JIT_BADOPTION; - -#else /* SUPPORT_JIT */ - pcre2_real_code *re = (pcre2_real_code *)code; -executable_functions *functions; -uint32_t excluded_options; -int result; + +#ifdef SUPPORT_JIT +executable_functions *functions = (executable_functions *)re->executable_jit; +static int executable_allocator_is_working = 0; +#endif if (code == NULL) return PCRE2_ERROR_NULL; @@ -14116,30 +13753,98 @@ if (code == NULL) if ((options & ~PUBLIC_JIT_COMPILE_OPTIONS) != 0) return PCRE2_ERROR_JIT_BADOPTION; +/* Support for invalid UTF was first introduced in JIT, with the option +PCRE2_JIT_INVALID_UTF. Later, support was added to the interpreter, and the +compile-time option PCRE2_MATCH_INVALID_UTF was created. This is now the +preferred feature, with the earlier option deprecated. However, for backward +compatibility, if the earlier option is set, it forces the new option so that +if JIT matching falls back to the interpreter, there is still support for +invalid UTF. However, if this function has already been successfully called +without PCRE2_JIT_INVALID_UTF and without PCRE2_MATCH_INVALID_UTF (meaning that +non-invalid-supporting JIT code was compiled), give an error. + +If in the future support for PCRE2_JIT_INVALID_UTF is withdrawn, the following +actions are needed: + + 1. Remove the definition from pcre2.h.in and from the list in + PUBLIC_JIT_COMPILE_OPTIONS above. + + 2. Replace PCRE2_JIT_INVALID_UTF with a local flag in this module. + + 3. Replace PCRE2_JIT_INVALID_UTF in pcre2_jit_test.c. + + 4. Delete the following short block of code. The setting of "re" and + "functions" can be moved into the JIT-only block below, but if that is + done, (void)re and (void)functions will be needed in the non-JIT case, to + avoid compiler warnings. +*/ + +if ((options & PCRE2_JIT_INVALID_UTF) != 0) + { + if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) == 0) + { +#ifdef SUPPORT_JIT + if (functions != NULL) return PCRE2_ERROR_JIT_BADOPTION; +#endif + re->overall_options |= PCRE2_MATCH_INVALID_UTF; + } + } + +/* The above tests are run with and without JIT support. This means that +PCRE2_JIT_INVALID_UTF propagates back into the regex options (ensuring +interpreter support) even in the absence of JIT. But now, if there is no JIT +support, give an error return. */ + +#ifndef SUPPORT_JIT +return PCRE2_ERROR_JIT_BADOPTION; +#else /* SUPPORT_JIT */ + +/* There is JIT support. Do the necessary. */ + if ((re->flags & PCRE2_NOJIT) != 0) return 0; -functions = (executable_functions *)re->executable_jit; +if (executable_allocator_is_working == 0) + { + /* Checks whether the executable allocator is working. This check + might run multiple times in multi-threaded environments, but the + result should not be affected by it. */ + void *ptr = SLJIT_MALLOC_EXEC(32); + + executable_allocator_is_working = -1; + + if (ptr != NULL) + { + SLJIT_FREE_EXEC(((sljit_u8*)(ptr)) + SLJIT_EXEC_OFFSET(ptr)); + executable_allocator_is_working = 1; + } + } + +if (executable_allocator_is_working < 0) + return PCRE2_ERROR_NOMEMORY; + +if ((re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0) + options |= PCRE2_JIT_INVALID_UTF; if ((options & PCRE2_JIT_COMPLETE) != 0 && (functions == NULL || functions->executable_funcs[0] == NULL)) { - excluded_options = (PCRE2_JIT_PARTIAL_SOFT | PCRE2_JIT_PARTIAL_HARD); - result = jit_compile(code, options & ~excluded_options); + uint32_t excluded_options = (PCRE2_JIT_PARTIAL_SOFT | PCRE2_JIT_PARTIAL_HARD); + int result = jit_compile(code, options & ~excluded_options); if (result != 0) return result; } if ((options & PCRE2_JIT_PARTIAL_SOFT) != 0 && (functions == NULL || functions->executable_funcs[1] == NULL)) { - excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_HARD); - result = jit_compile(code, options & ~excluded_options); + uint32_t excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_HARD); + int result = jit_compile(code, options & ~excluded_options); if (result != 0) return result; } if ((options & PCRE2_JIT_PARTIAL_HARD) != 0 && (functions == NULL || functions->executable_funcs[2] == NULL)) { - excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_SOFT); - result = jit_compile(code, options & ~excluded_options); + uint32_t excluded_options = (PCRE2_JIT_COMPLETE | PCRE2_JIT_PARTIAL_SOFT); + int result = jit_compile(code, options & ~excluded_options); if (result != 0) return result; } diff --git a/src/3rdparty/pcre2/src/pcre2_jit_match.c b/src/3rdparty/pcre2/src/pcre2_jit_match.c index eee038644d..7e13b8cfee 100644 --- a/src/3rdparty/pcre2/src/pcre2_jit_match.c +++ b/src/3rdparty/pcre2/src/pcre2_jit_match.c @@ -74,7 +74,6 @@ Arguments: options option bits match_data points to a match_data block mcontext points to a match context - jit_stack points to a JIT stack Returns: > 0 => success; value is the number of ovector pairs filled = 0 => success, but ovector is not big enough diff --git a/src/3rdparty/pcre2/src/pcre2_jit_neon_inc.h b/src/3rdparty/pcre2/src/pcre2_jit_neon_inc.h new file mode 100644 index 0000000000..55b1f32ac9 --- /dev/null +++ b/src/3rdparty/pcre2/src/pcre2_jit_neon_inc.h @@ -0,0 +1,321 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* PCRE is a library of functions to support regular expressions whose syntax +and semantics are as close as possible to those of the Perl 5 language. + + Written by Philip Hazel + This module by Zoltan Herczeg and Sebastian Pop + Original API code Copyright (c) 1997-2012 University of Cambridge + New API code Copyright (c) 2016-2019 University of Cambridge + +----------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +----------------------------------------------------------------------------- +*/ + +# if defined(FFCS) +# if defined(FF_UTF) +# define FF_FUN ffcs_utf +# else +# define FF_FUN ffcs +# endif + +# elif defined(FFCS_2) +# if defined(FF_UTF) +# define FF_FUN ffcs_2_utf +# else +# define FF_FUN ffcs_2 +# endif + +# elif defined(FFCS_MASK) +# if defined(FF_UTF) +# define FF_FUN ffcs_mask_utf +# else +# define FF_FUN ffcs_mask +# endif + +# elif defined(FFCPS_0) +# if defined (FF_UTF) +# define FF_FUN ffcps_0_utf +# else +# define FF_FUN ffcps_0 +# endif + +# elif defined (FFCPS_1) +# if defined (FF_UTF) +# define FF_FUN ffcps_1_utf +# else +# define FF_FUN ffcps_1 +# endif + +# elif defined (FFCPS_DEFAULT) +# if defined (FF_UTF) +# define FF_FUN ffcps_default_utf +# else +# define FF_FUN ffcps_default +# endif +# endif + +static sljit_u8* SLJIT_FUNC FF_FUN(sljit_u8 *str_end, sljit_u8 *str_ptr, sljit_uw offs1, sljit_uw offs2, sljit_uw chars) +#undef FF_FUN +{ +quad_word qw; +int_char ic; +ic.x = chars; + +#if defined(FFCS) +sljit_u8 c1 = ic.c.c1; +vect_t vc1 = VDUPQ(c1); + +#elif defined(FFCS_2) +sljit_u8 c1 = ic.c.c1; +vect_t vc1 = VDUPQ(c1); +sljit_u8 c2 = ic.c.c2; +vect_t vc2 = VDUPQ(c2); + +#elif defined(FFCS_MASK) +sljit_u8 c1 = ic.c.c1; +vect_t vc1 = VDUPQ(c1); +sljit_u8 mask = ic.c.c2; +vect_t vmask = VDUPQ(mask); +#endif + +#if defined(FFCPS) +compare_type compare1_type = compare_match1; +compare_type compare2_type = compare_match1; +vect_t cmp1a, cmp1b, cmp2a, cmp2b; +const sljit_u32 diff = IN_UCHARS(offs1 - offs2); +PCRE2_UCHAR char1a = ic.c.c1; +PCRE2_UCHAR char2a = ic.c.c3; + +# ifdef FFCPS_CHAR1A2A +cmp1a = VDUPQ(char1a); +cmp2a = VDUPQ(char2a); +# else +PCRE2_UCHAR char1b = ic.c.c2; +PCRE2_UCHAR char2b = ic.c.c4; +if (char1a == char1b) + cmp1a = VDUPQ(char1a); +else + { + sljit_u32 bit1 = char1a ^ char1b; + if (is_powerof2(bit1)) + { + compare1_type = compare_match1i; + cmp1a = VDUPQ(char1a | bit1); + cmp1b = VDUPQ(bit1); + } + else + { + compare1_type = compare_match2; + cmp1a = VDUPQ(char1a); + cmp1b = VDUPQ(char1b); + } + } + +if (char2a == char2b) + cmp2a = VDUPQ(char2a); +else + { + sljit_u32 bit2 = char2a ^ char2b; + if (is_powerof2(bit2)) + { + compare2_type = compare_match1i; + cmp2a = VDUPQ(char2a | bit2); + cmp2b = VDUPQ(bit2); + } + else + { + compare2_type = compare_match2; + cmp2a = VDUPQ(char2a); + cmp2b = VDUPQ(char2b); + } + } +# endif + +str_ptr += IN_UCHARS(offs1); +#endif + +#if PCRE2_CODE_UNIT_WIDTH != 8 +vect_t char_mask = VDUPQ(0xff); +#endif + +#if defined(FF_UTF) +restart:; +#endif + +#if defined(FFCPS) +sljit_u8 *p1 = str_ptr - diff; +#endif +sljit_s32 align_offset = ((uint64_t)str_ptr & 0xf); +str_ptr = (sljit_u8 *) ((uint64_t)str_ptr & ~0xf); +vect_t data = VLD1Q(str_ptr); +#if PCRE2_CODE_UNIT_WIDTH != 8 +data = VANDQ(data, char_mask); +#endif + +#if defined(FFCS) +vect_t eq = VCEQQ(data, vc1); + +#elif defined(FFCS_2) +vect_t eq1 = VCEQQ(data, vc1); +vect_t eq2 = VCEQQ(data, vc2); +vect_t eq = VORRQ(eq1, eq2); + +#elif defined(FFCS_MASK) +vect_t eq = VORRQ(data, vmask); +eq = VCEQQ(eq, vc1); + +#elif defined(FFCPS) +# if defined(FFCPS_DIFF1) +vect_t prev_data = data; +# endif + +vect_t data2; +if (p1 < str_ptr) + { + data2 = VLD1Q(str_ptr - diff); +#if PCRE2_CODE_UNIT_WIDTH != 8 + data2 = VANDQ(data2, char_mask); +#endif + } +else + data2 = shift_left_n_lanes(data, offs1 - offs2); + +data = fast_forward_char_pair_compare(compare1_type, data, cmp1a, cmp1b); +data2 = fast_forward_char_pair_compare(compare2_type, data2, cmp2a, cmp2b); +vect_t eq = VANDQ(data, data2); +#endif + +VST1Q(qw.mem, eq); +/* Ignore matches before the first STR_PTR. */ +if (align_offset < 8) + { + qw.dw[0] >>= align_offset * 8; + if (qw.dw[0]) + { + str_ptr += align_offset + __builtin_ctzll(qw.dw[0]) / 8; + goto match; + } + if (qw.dw[1]) + { + str_ptr += 8 + __builtin_ctzll(qw.dw[1]) / 8; + goto match; + } + } +else + { + qw.dw[1] >>= (align_offset - 8) * 8; + if (qw.dw[1]) + { + str_ptr += align_offset + __builtin_ctzll(qw.dw[1]) / 8; + goto match; + } + } +str_ptr += 16; + +while (str_ptr < str_end) + { + vect_t orig_data = VLD1Q(str_ptr); +#if PCRE2_CODE_UNIT_WIDTH != 8 + orig_data = VANDQ(orig_data, char_mask); +#endif + data = orig_data; + +#if defined(FFCS) + eq = VCEQQ(data, vc1); + +#elif defined(FFCS_2) + eq1 = VCEQQ(data, vc1); + eq2 = VCEQQ(data, vc2); + eq = VORRQ(eq1, eq2); + +#elif defined(FFCS_MASK) + eq = VORRQ(data, vmask); + eq = VCEQQ(eq, vc1); +#endif + +#if defined(FFCPS) +# if defined (FFCPS_DIFF1) + data2 = VEXTQ(prev_data, data, VECTOR_FACTOR - 1); +# else + data2 = VLD1Q(str_ptr - diff); +# if PCRE2_CODE_UNIT_WIDTH != 8 + data2 = VANDQ(data2, char_mask); +# endif +# endif + +# ifdef FFCPS_CHAR1A2A + data = VCEQQ(data, cmp1a); + data2 = VCEQQ(data2, cmp2a); +# else + data = fast_forward_char_pair_compare(compare1_type, data, cmp1a, cmp1b); + data2 = fast_forward_char_pair_compare(compare2_type, data2, cmp2a, cmp2b); +# endif + + eq = VANDQ(data, data2); +#endif + + VST1Q(qw.mem, eq); + if (qw.dw[0]) + str_ptr += __builtin_ctzll(qw.dw[0]) / 8; + else if (qw.dw[1]) + str_ptr += 8 + __builtin_ctzll(qw.dw[1]) / 8; + else { + str_ptr += 16; +#if defined (FFCPS_DIFF1) + prev_data = orig_data; +#endif + continue; + } + +match:; + if (str_ptr >= str_end) + /* Failed match. */ + return NULL; + +#if defined(FF_UTF) + if (utf_continue(str_ptr + IN_UCHARS(-offs1))) + { + /* Not a match. */ + str_ptr += IN_UCHARS(1); + goto restart; + } +#endif + + /* Match. */ +#if defined (FFCPS) + str_ptr -= IN_UCHARS(offs1); +#endif + return str_ptr; + } + +/* Failed match. */ +return NULL; +} diff --git a/src/3rdparty/pcre2/src/pcre2_jit_simd_inc.h b/src/3rdparty/pcre2/src/pcre2_jit_simd_inc.h new file mode 100644 index 0000000000..f7d56b29f8 --- /dev/null +++ b/src/3rdparty/pcre2/src/pcre2_jit_simd_inc.h @@ -0,0 +1,993 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* PCRE is a library of functions to support regular expressions whose syntax +and semantics are as close as possible to those of the Perl 5 language. + + Written by Philip Hazel + This module by Zoltan Herczeg + Original API code Copyright (c) 1997-2012 University of Cambridge + New API code Copyright (c) 2016-2019 University of Cambridge + +----------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +----------------------------------------------------------------------------- +*/ + +#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) && !(defined SUPPORT_VALGRIND) + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +static struct sljit_jump *jump_if_utf_char_start(struct sljit_compiler *compiler, sljit_s32 reg) +{ +#if PCRE2_CODE_UNIT_WIDTH == 8 +OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xc0); +return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0x80); +#elif PCRE2_CODE_UNIT_WIDTH == 16 +OP2(SLJIT_AND, reg, 0, reg, 0, SLJIT_IMM, 0xfc00); +return CMP(SLJIT_NOT_EQUAL, reg, 0, SLJIT_IMM, 0xdc00); +#else +#error "Unknown code width" +#endif +} +#endif + +static sljit_s32 character_to_int32(PCRE2_UCHAR chr) +{ +sljit_u32 value = chr; +#if PCRE2_CODE_UNIT_WIDTH == 8 +#define SSE2_COMPARE_TYPE_INDEX 0 +return (sljit_s32)((value << 24) | (value << 16) | (value << 8) | value); +#elif PCRE2_CODE_UNIT_WIDTH == 16 +#define SSE2_COMPARE_TYPE_INDEX 1 +return (sljit_s32)((value << 16) | value); +#elif PCRE2_CODE_UNIT_WIDTH == 32 +#define SSE2_COMPARE_TYPE_INDEX 2 +return (sljit_s32)(value); +#else +#error "Unsupported unit width" +#endif +} + +static void load_from_mem_sse2(struct sljit_compiler *compiler, sljit_s32 dst_xmm_reg, sljit_s32 src_general_reg, sljit_s8 offset) +{ +sljit_u8 instruction[5]; + +SLJIT_ASSERT(dst_xmm_reg < 8); +SLJIT_ASSERT(src_general_reg < 8); + +/* MOVDQA xmm1, xmm2/m128 */ +instruction[0] = ((sljit_u8)offset & 0xf) == 0 ? 0x66 : 0xf3; +instruction[1] = 0x0f; +instruction[2] = 0x6f; + +if (offset == 0) + { + instruction[3] = (dst_xmm_reg << 3) | src_general_reg; + sljit_emit_op_custom(compiler, instruction, 4); + return; + } + +instruction[3] = 0x40 | (dst_xmm_reg << 3) | src_general_reg; +instruction[4] = (sljit_u8)offset; +sljit_emit_op_custom(compiler, instruction, 5); +} + +typedef enum { + sse2_compare_match1, + sse2_compare_match1i, + sse2_compare_match2, +} sse2_compare_type; + +static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *compiler, sse2_compare_type compare_type, + int step, sljit_s32 dst_ind, sljit_s32 cmp1_ind, sljit_s32 cmp2_ind, sljit_s32 tmp_ind) +{ +sljit_u8 instruction[4]; +instruction[0] = 0x66; +instruction[1] = 0x0f; + +SLJIT_ASSERT(step >= 0 && step <= 3); + +if (compare_type != sse2_compare_match2) + { + if (step == 0) + { + if (compare_type == sse2_compare_match1i) + { + /* POR xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0xeb; + instruction[3] = 0xc0 | (dst_ind << 3) | cmp2_ind; + sljit_emit_op_custom(compiler, instruction, 4); + } + return; + } + + if (step != 2) + return; + + /* PCMPEQB/W/D xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; + instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; + sljit_emit_op_custom(compiler, instruction, 4); + return; + } + +switch (step) + { + case 0: + /* MOVDQA xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0x6f; + instruction[3] = 0xc0 | (tmp_ind << 3) | dst_ind; + sljit_emit_op_custom(compiler, instruction, 4); + return; + + case 1: + /* PCMPEQB/W/D xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; + instruction[3] = 0xc0 | (dst_ind << 3) | cmp1_ind; + sljit_emit_op_custom(compiler, instruction, 4); + return; + + case 2: + /* PCMPEQB/W/D xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0x74 + SSE2_COMPARE_TYPE_INDEX; + instruction[3] = 0xc0 | (tmp_ind << 3) | cmp2_ind; + sljit_emit_op_custom(compiler, instruction, 4); + return; + + case 3: + /* POR xmm1, xmm2/m128 */ + /* instruction[0] = 0x66; */ + /* instruction[1] = 0x0f; */ + instruction[2] = 0xeb; + instruction[3] = 0xc0 | (dst_ind << 3) | tmp_ind; + sljit_emit_op_custom(compiler, instruction, 4); + return; + } +} + +#define JIT_HAS_FAST_FORWARD_CHAR_SIMD (sljit_has_cpu_feature(SLJIT_HAS_SSE2)) + +static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset) +{ +DEFINE_COMPILER; +struct sljit_label *start; +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +struct sljit_label *restart; +#endif +struct sljit_jump *quit; +struct sljit_jump *partial_quit[2]; +sse2_compare_type compare_type = sse2_compare_match1; +sljit_u8 instruction[8]; +sljit_s32 tmp1_reg_ind = sljit_get_register_index(TMP1); +sljit_s32 str_ptr_reg_ind = sljit_get_register_index(STR_PTR); +sljit_s32 data_ind = 0; +sljit_s32 tmp_ind = 1; +sljit_s32 cmp1_ind = 2; +sljit_s32 cmp2_ind = 3; +sljit_u32 bit = 0; +int i; + +SLJIT_UNUSED_ARG(offset); + +if (char1 != char2) + { + bit = char1 ^ char2; + compare_type = sse2_compare_match1i; + + if (!is_powerof2(bit)) + { + bit = 0; + compare_type = sse2_compare_match2; + } + } + +partial_quit[0] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); +if (common->mode == PCRE2_JIT_COMPLETE) + add_jump(compiler, &common->failed_match, partial_quit[0]); + +/* First part (unaligned start) */ + +OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1 | bit)); + +SLJIT_ASSERT(tmp1_reg_ind < 8); + +/* MOVD xmm, r/m32 */ +instruction[0] = 0x66; +instruction[1] = 0x0f; +instruction[2] = 0x6e; +instruction[3] = 0xc0 | (cmp1_ind << 3) | tmp1_reg_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +if (char1 != char2) + { + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(bit != 0 ? bit : char2)); + + /* MOVD xmm, r/m32 */ + instruction[3] = 0xc0 | (cmp2_ind << 3) | tmp1_reg_ind; + sljit_emit_op_custom(compiler, instruction, 4); + } + +OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); + +/* PSHUFD xmm1, xmm2/m128, imm8 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0x70; +instruction[3] = 0xc0 | (cmp1_ind << 3) | cmp1_ind; +instruction[4] = 0; +sljit_emit_op_custom(compiler, instruction, 5); + +if (char1 != char2) + { + /* PSHUFD xmm1, xmm2/m128, imm8 */ + instruction[3] = 0xc0 | (cmp2_ind << 3) | cmp2_ind; + sljit_emit_op_custom(compiler, instruction, 5); + } + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +restart = LABEL(); +#endif +OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf); +OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf); + +load_from_mem_sse2(compiler, data_ind, str_ptr_reg_ind, 0); +for (i = 0; i < 4; i++) + fast_forward_char_pair_sse2_compare(compiler, compare_type, i, data_ind, cmp1_ind, cmp2_ind, tmp_ind); + +/* PMOVMSKB reg, xmm */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xd7; +instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | data_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0); +OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0); + +quit = CMP(SLJIT_NOT_ZERO, TMP1, 0, SLJIT_IMM, 0); + +OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); + +/* Second part (aligned) */ +start = LABEL(); + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16); + +partial_quit[1] = CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0); +if (common->mode == PCRE2_JIT_COMPLETE) + add_jump(compiler, &common->failed_match, partial_quit[1]); + +load_from_mem_sse2(compiler, data_ind, str_ptr_reg_ind, 0); +for (i = 0; i < 4; i++) + fast_forward_char_pair_sse2_compare(compiler, compare_type, i, data_ind, cmp1_ind, cmp2_ind, tmp_ind); + +/* PMOVMSKB reg, xmm */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xd7; +instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | data_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +CMPTO(SLJIT_ZERO, TMP1, 0, SLJIT_IMM, 0, start); + +JUMPHERE(quit); + +/* BSF r32, r/m32 */ +instruction[0] = 0x0f; +instruction[1] = 0xbc; +instruction[2] = 0xc0 | (tmp1_reg_ind << 3) | tmp1_reg_ind; +sljit_emit_op_custom(compiler, instruction, 3); + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); + +if (common->mode != PCRE2_JIT_COMPLETE) + { + JUMPHERE(partial_quit[0]); + JUMPHERE(partial_quit[1]); + OP2(SLJIT_SUB | SLJIT_SET_GREATER, SLJIT_UNUSED, 0, STR_PTR, 0, STR_END, 0); + CMOV(SLJIT_GREATER, STR_PTR, STR_END, 0); + } +else + add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +if (common->utf && offset > 0) + { + SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE); + + OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offset)); + + quit = jump_if_utf_char_start(compiler, TMP1); + + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); + OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); + JUMPTO(SLJIT_JUMP, restart); + + JUMPHERE(quit); + } +#endif +} + +#ifndef _WIN64 + +static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_offset(void) +{ +#if PCRE2_CODE_UNIT_WIDTH == 8 +return 15; +#elif PCRE2_CODE_UNIT_WIDTH == 16 +return 7; +#elif PCRE2_CODE_UNIT_WIDTH == 32 +return 3; +#else +#error "Unsupported unit width" +#endif +} + +#define JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD (sljit_has_cpu_feature(SLJIT_HAS_SSE2)) + +static void fast_forward_char_pair_simd(compiler_common *common, sljit_s32 offs1, + PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b) +{ +DEFINE_COMPILER; +sse2_compare_type compare1_type = sse2_compare_match1; +sse2_compare_type compare2_type = sse2_compare_match1; +sljit_u32 bit1 = 0; +sljit_u32 bit2 = 0; +sljit_u32 diff = IN_UCHARS(offs1 - offs2); +sljit_s32 tmp1_reg_ind = sljit_get_register_index(TMP1); +sljit_s32 tmp2_reg_ind = sljit_get_register_index(TMP2); +sljit_s32 str_ptr_reg_ind = sljit_get_register_index(STR_PTR); +sljit_s32 data1_ind = 0; +sljit_s32 data2_ind = 1; +sljit_s32 tmp1_ind = 2; +sljit_s32 tmp2_ind = 3; +sljit_s32 cmp1a_ind = 4; +sljit_s32 cmp1b_ind = 5; +sljit_s32 cmp2a_ind = 6; +sljit_s32 cmp2b_ind = 7; +struct sljit_label *start; +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +struct sljit_label *restart; +#endif +struct sljit_jump *jump[2]; +sljit_u8 instruction[8]; +int i; + +SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2); +SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_offset())); +SLJIT_ASSERT(tmp1_reg_ind < 8 && tmp2_reg_ind == 1); + +/* Initialize. */ +if (common->match_end_ptr != 0) + { + OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); + OP1(SLJIT_MOV, TMP3, 0, STR_END, 0); + OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1)); + + OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0); + CMOV(SLJIT_LESS, STR_END, TMP1, 0); + } + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1)); +add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); + +/* MOVD xmm, r/m32 */ +instruction[0] = 0x66; +instruction[1] = 0x0f; +instruction[2] = 0x6e; + +if (char1a == char1b) + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a)); +else + { + bit1 = char1a ^ char1b; + if (is_powerof2(bit1)) + { + compare1_type = sse2_compare_match1i; + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a | bit1)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit1)); + } + else + { + compare1_type = sse2_compare_match2; + bit1 = 0; + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char1a)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char1b)); + } + } + +instruction[3] = 0xc0 | (cmp1a_ind << 3) | tmp1_reg_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +if (char1a != char1b) + { + instruction[3] = 0xc0 | (cmp1b_ind << 3) | tmp2_reg_ind; + sljit_emit_op_custom(compiler, instruction, 4); + } + +if (char2a == char2b) + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a)); +else + { + bit2 = char2a ^ char2b; + if (is_powerof2(bit2)) + { + compare2_type = sse2_compare_match1i; + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a | bit2)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(bit2)); + } + else + { + compare2_type = sse2_compare_match2; + bit2 = 0; + OP1(SLJIT_MOV, TMP1, 0, SLJIT_IMM, character_to_int32(char2a)); + OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, character_to_int32(char2b)); + } + } + +instruction[3] = 0xc0 | (cmp2a_ind << 3) | tmp1_reg_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +if (char2a != char2b) + { + instruction[3] = 0xc0 | (cmp2b_ind << 3) | tmp2_reg_ind; + sljit_emit_op_custom(compiler, instruction, 4); + } + +/* PSHUFD xmm1, xmm2/m128, imm8 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0x70; +instruction[4] = 0; + +instruction[3] = 0xc0 | (cmp1a_ind << 3) | cmp1a_ind; +sljit_emit_op_custom(compiler, instruction, 5); + +if (char1a != char1b) + { + instruction[3] = 0xc0 | (cmp1b_ind << 3) | cmp1b_ind; + sljit_emit_op_custom(compiler, instruction, 5); + } + +instruction[3] = 0xc0 | (cmp2a_ind << 3) | cmp2a_ind; +sljit_emit_op_custom(compiler, instruction, 5); + +if (char2a != char2b) + { + instruction[3] = 0xc0 | (cmp2b_ind << 3) | cmp2b_ind; + sljit_emit_op_custom(compiler, instruction, 5); + } + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +restart = LABEL(); +#endif + +OP2(SLJIT_SUB, TMP1, 0, STR_PTR, 0, SLJIT_IMM, diff); +OP1(SLJIT_MOV, TMP2, 0, STR_PTR, 0); +OP2(SLJIT_AND, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, ~0xf); + +load_from_mem_sse2(compiler, data1_ind, str_ptr_reg_ind, 0); + +jump[0] = CMP(SLJIT_GREATER_EQUAL, TMP1, 0, STR_PTR, 0); + +load_from_mem_sse2(compiler, data2_ind, str_ptr_reg_ind, -(sljit_s8)diff); +jump[1] = JUMP(SLJIT_JUMP); + +JUMPHERE(jump[0]); + +/* MOVDQA xmm1, xmm2/m128 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0x6f; +instruction[3] = 0xc0 | (data2_ind << 3) | data1_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +/* PSLLDQ xmm1, imm8 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0x73; +instruction[3] = 0xc0 | (7 << 3) | data2_ind; +instruction[4] = diff; +sljit_emit_op_custom(compiler, instruction, 5); + +JUMPHERE(jump[1]); + +OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 0xf); + +for (i = 0; i < 4; i++) + { + fast_forward_char_pair_sse2_compare(compiler, compare2_type, i, data2_ind, cmp2a_ind, cmp2b_ind, tmp2_ind); + fast_forward_char_pair_sse2_compare(compiler, compare1_type, i, data1_ind, cmp1a_ind, cmp1b_ind, tmp1_ind); + } + +/* PAND xmm1, xmm2/m128 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xdb; +instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +/* PMOVMSKB reg, xmm */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xd7; +instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | 0; +sljit_emit_op_custom(compiler, instruction, 4); + +/* Ignore matches before the first STR_PTR. */ +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0); +OP2(SLJIT_LSHR, TMP1, 0, TMP1, 0, TMP2, 0); + +jump[0] = CMP(SLJIT_NOT_ZERO, TMP1, 0, SLJIT_IMM, 0); + +OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, TMP2, 0); + +/* Main loop. */ +start = LABEL(); + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, 16); +add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); + +load_from_mem_sse2(compiler, data1_ind, str_ptr_reg_ind, 0); +load_from_mem_sse2(compiler, data2_ind, str_ptr_reg_ind, -(sljit_s8)diff); + +for (i = 0; i < 4; i++) + { + fast_forward_char_pair_sse2_compare(compiler, compare1_type, i, data1_ind, cmp1a_ind, cmp1b_ind, tmp2_ind); + fast_forward_char_pair_sse2_compare(compiler, compare2_type, i, data2_ind, cmp2a_ind, cmp2b_ind, tmp1_ind); + } + +/* PAND xmm1, xmm2/m128 */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xdb; +instruction[3] = 0xc0 | (data1_ind << 3) | data2_ind; +sljit_emit_op_custom(compiler, instruction, 4); + +/* PMOVMSKB reg, xmm */ +/* instruction[0] = 0x66; */ +/* instruction[1] = 0x0f; */ +instruction[2] = 0xd7; +instruction[3] = 0xc0 | (tmp1_reg_ind << 3) | 0; +sljit_emit_op_custom(compiler, instruction, 4); + +CMPTO(SLJIT_ZERO, TMP1, 0, SLJIT_IMM, 0, start); + +JUMPHERE(jump[0]); + +/* BSF r32, r/m32 */ +instruction[0] = 0x0f; +instruction[1] = 0xbc; +instruction[2] = 0xc0 | (tmp1_reg_ind << 3) | tmp1_reg_ind; +sljit_emit_op_custom(compiler, instruction, 3); + +OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0); + +add_jump(compiler, &common->failed_match, CMP(SLJIT_GREATER_EQUAL, STR_PTR, 0, STR_END, 0)); + +if (common->match_end_ptr != 0) + OP1(SLJIT_MOV, STR_END, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +if (common->utf) + { + OP1(MOV_UCHAR, TMP1, 0, SLJIT_MEM1(STR_PTR), IN_UCHARS(-offs1)); + + jump[0] = jump_if_utf_char_start(compiler, TMP1); + + OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(1)); + CMPTO(SLJIT_LESS, STR_PTR, 0, STR_END, 0, restart); + + add_jump(compiler, &common->failed_match, JUMP(SLJIT_JUMP)); + + JUMPHERE(jump[0]); + } +#endif + +OP2(SLJIT_SUB, STR_PTR, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(offs1)); + +if (common->match_end_ptr != 0) + OP1(SLJIT_MOV, STR_END, 0, TMP3, 0); +} + +#endif /* !_WIN64 */ + +#undef SSE2_COMPARE_TYPE_INDEX + +#endif /* SLJIT_CONFIG_X86 && !SUPPORT_VALGRIND */ + +#if (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64 && (defined __ARM_NEON || defined __ARM_NEON__)) + +#include + +typedef union { + unsigned int x; + struct { unsigned char c1, c2, c3, c4; } c; +} int_char; + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +static SLJIT_INLINE int utf_continue(sljit_u8 *s) +{ +#if PCRE2_CODE_UNIT_WIDTH == 8 +return (*s & 0xc0) == 0x80; +#elif PCRE2_CODE_UNIT_WIDTH == 16 +return (*s & 0xfc00) == 0xdc00; +#else +#error "Unknown code width" +#endif +} +#endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 */ + +#if PCRE2_CODE_UNIT_WIDTH == 8 +# define VECTOR_FACTOR 16 +# define vect_t uint8x16_t +# define VLD1Q(X) vld1q_u8((sljit_u8 *)(X)) +# define VCEQQ vceqq_u8 +# define VORRQ vorrq_u8 +# define VST1Q vst1q_u8 +# define VDUPQ vdupq_n_u8 +# define VEXTQ vextq_u8 +# define VANDQ vandq_u8 +typedef union { + uint8_t mem[16]; + uint64_t dw[2]; +} quad_word; +#elif PCRE2_CODE_UNIT_WIDTH == 16 +# define VECTOR_FACTOR 8 +# define vect_t uint16x8_t +# define VLD1Q(X) vld1q_u16((sljit_u16 *)(X)) +# define VCEQQ vceqq_u16 +# define VORRQ vorrq_u16 +# define VST1Q vst1q_u16 +# define VDUPQ vdupq_n_u16 +# define VEXTQ vextq_u16 +# define VANDQ vandq_u16 +typedef union { + uint16_t mem[8]; + uint64_t dw[2]; +} quad_word; +#else +# define VECTOR_FACTOR 4 +# define vect_t uint32x4_t +# define VLD1Q(X) vld1q_u32((sljit_u32 *)(X)) +# define VCEQQ vceqq_u32 +# define VORRQ vorrq_u32 +# define VST1Q vst1q_u32 +# define VDUPQ vdupq_n_u32 +# define VEXTQ vextq_u32 +# define VANDQ vandq_u32 +typedef union { + uint32_t mem[4]; + uint64_t dw[2]; +} quad_word; +#endif + +#define FFCS +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCS + +#define FFCS_2 +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCS_2 + +#define FFCS_MASK +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCS_MASK + +#define JIT_HAS_FAST_FORWARD_CHAR_SIMD 1 + +static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR char1, PCRE2_UCHAR char2, sljit_s32 offset) +{ +DEFINE_COMPILER; +int_char ic; +struct sljit_jump *partial_quit; +/* Save temporary registers. */ +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STR_PTR, 0); +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP3, 0); + +/* Prepare function arguments */ +OP1(SLJIT_MOV, SLJIT_R0, 0, STR_END, 0); +OP1(SLJIT_MOV, SLJIT_R1, 0, STR_PTR, 0); +OP1(SLJIT_MOV, SLJIT_R2, 0, SLJIT_IMM, offset); + +if (char1 == char2) + { + ic.c.c1 = char1; + ic.c.c2 = char2; + OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x); + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf && offset > 0) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_utf)); + else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs)); +#else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs)); +#endif + } +else + { + PCRE2_UCHAR mask = char1 ^ char2; + if (is_powerof2(mask)) + { + ic.c.c1 = char1 | mask; + ic.c.c2 = mask; + OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x); + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf && offset > 0) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask_utf)); + else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask)); +#else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_mask)); +#endif + } + else + { + ic.c.c1 = char1; + ic.c.c2 = char2; + OP1(SLJIT_MOV, SLJIT_R4, 0, SLJIT_IMM, ic.x); + +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf && offset > 0) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2_utf)); + else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2)); +#else + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(UW) | SLJIT_ARG3(UW) | SLJIT_ARG4(UW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcs_2)); +#endif + } + } +/* Restore registers. */ +OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); +OP1(SLJIT_MOV, TMP3, 0, SLJIT_MEM1(SLJIT_SP), LOCALS1); + +/* Check return value. */ +partial_quit = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0); +if (common->mode == PCRE2_JIT_COMPLETE) + add_jump(compiler, &common->failed_match, partial_quit); + +/* Fast forward STR_PTR to the result of memchr. */ +OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0); + +if (common->mode != PCRE2_JIT_COMPLETE) + JUMPHERE(partial_quit); +} + +typedef enum { + compare_match1, + compare_match1i, + compare_match2, +} compare_type; + +static inline vect_t fast_forward_char_pair_compare(compare_type ctype, vect_t dst, vect_t cmp1, vect_t cmp2) +{ +if (ctype == compare_match2) + { + vect_t tmp = dst; + dst = VCEQQ(dst, cmp1); + tmp = VCEQQ(tmp, cmp2); + dst = VORRQ(dst, tmp); + return dst; + } + +if (ctype == compare_match1i) + dst = VORRQ(dst, cmp2); +dst = VCEQQ(dst, cmp1); +return dst; +} + +static SLJIT_INLINE sljit_u32 max_fast_forward_char_pair_offset(void) +{ +#if PCRE2_CODE_UNIT_WIDTH == 8 +return 15; +#elif PCRE2_CODE_UNIT_WIDTH == 16 +return 7; +#elif PCRE2_CODE_UNIT_WIDTH == 32 +return 3; +#else +#error "Unsupported unit width" +#endif +} + +/* ARM doesn't have a shift left across lanes. */ +static SLJIT_INLINE vect_t shift_left_n_lanes(vect_t a, sljit_u8 n) +{ +vect_t zero = VDUPQ(0); +SLJIT_ASSERT(0 < n && n < VECTOR_FACTOR); +/* VEXTQ takes an immediate as last argument. */ +#define C(X) case X: return VEXTQ(zero, a, VECTOR_FACTOR - X); +switch (n) + { + C(1); C(2); C(3); +#if PCRE2_CODE_UNIT_WIDTH != 32 + C(4); C(5); C(6); C(7); +# if PCRE2_CODE_UNIT_WIDTH != 16 + C(8); C(9); C(10); C(11); C(12); C(13); C(14); C(15); +# endif +#endif + default: + /* Based on the ASSERT(0 < n && n < VECTOR_FACTOR) above, this won't + happen. The return is still here for compilers to not warn. */ + return a; + } +} + +#define FFCPS +#define FFCPS_DIFF1 +#define FFCPS_CHAR1A2A + +#define FFCPS_0 +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCPS_0 + +#undef FFCPS_CHAR1A2A + +#define FFCPS_1 +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCPS_1 + +#undef FFCPS_DIFF1 + +#define FFCPS_DEFAULT +#include "pcre2_jit_neon_inc.h" +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 +# define FF_UTF +# include "pcre2_jit_neon_inc.h" +# undef FF_UTF +#endif +#undef FFCPS + +#define JIT_HAS_FAST_FORWARD_CHAR_PAIR_SIMD 1 + +static void fast_forward_char_pair_simd(compiler_common *common, sljit_s32 offs1, + PCRE2_UCHAR char1a, PCRE2_UCHAR char1b, sljit_s32 offs2, PCRE2_UCHAR char2a, PCRE2_UCHAR char2b) +{ +DEFINE_COMPILER; +sljit_u32 diff = IN_UCHARS(offs1 - offs2); +struct sljit_jump *partial_quit; +int_char ic; +SLJIT_ASSERT(common->mode == PCRE2_JIT_COMPLETE && offs1 > offs2); +SLJIT_ASSERT(diff <= IN_UCHARS(max_fast_forward_char_pair_offset())); +SLJIT_ASSERT(compiler->scratches == 5); + +/* Save temporary register STR_PTR. */ +OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS0, STR_PTR, 0); + +/* Prepare arguments for the function call. */ +if (common->match_end_ptr == 0) + OP1(SLJIT_MOV, SLJIT_R0, 0, STR_END, 0); +else + { + OP1(SLJIT_MOV, SLJIT_R0, 0, SLJIT_MEM1(SLJIT_SP), common->match_end_ptr); + OP2(SLJIT_ADD, SLJIT_R0, 0, SLJIT_R0, 0, SLJIT_IMM, IN_UCHARS(offs1 + 1)); + + OP2(SLJIT_SUB | SLJIT_SET_LESS, SLJIT_UNUSED, 0, STR_END, 0, SLJIT_R0, 0); + CMOV(SLJIT_LESS, SLJIT_R0, STR_END, 0); + } + +OP1(SLJIT_MOV, SLJIT_R1, 0, STR_PTR, 0); +OP1(SLJIT_MOV_S32, SLJIT_R2, 0, SLJIT_IMM, offs1); +OP1(SLJIT_MOV_S32, SLJIT_R3, 0, SLJIT_IMM, offs2); +ic.c.c1 = char1a; +ic.c.c2 = char1b; +ic.c.c3 = char2a; +ic.c.c4 = char2b; +OP1(SLJIT_MOV_U32, SLJIT_R4, 0, SLJIT_IMM, ic.x); + +if (diff == 1) { + if (char1a == char1b && char2a == char2b) { +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_0_utf)); + else +#endif + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_0)); + } else { +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_1_utf)); + else +#endif + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_1)); + } +} else { +#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 32 + if (common->utf) + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_default_utf)); + else +#endif + sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_RET(SW) | SLJIT_ARG1(SW) | SLJIT_ARG2(SW) | SLJIT_ARG3(SW) | SLJIT_ARG4(SW), + SLJIT_IMM, SLJIT_FUNC_OFFSET(ffcps_default)); +} + +/* Restore STR_PTR register. */ +OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), LOCALS0); + +/* Check return value. */ +partial_quit = CMP(SLJIT_EQUAL, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0); +add_jump(compiler, &common->failed_match, partial_quit); + +/* Fast forward STR_PTR to the result of memchr. */ +OP1(SLJIT_MOV, STR_PTR, 0, SLJIT_RETURN_REG, 0); + +JUMPHERE(partial_quit); +} + +#endif /* SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64 */ diff --git a/src/3rdparty/pcre2/src/pcre2_maketables.c b/src/3rdparty/pcre2/src/pcre2_maketables.c index 5921e90793..8c93b4b573 100644 --- a/src/3rdparty/pcre2/src/pcre2_maketables.c +++ b/src/3rdparty/pcre2/src/pcre2_maketables.c @@ -147,4 +147,15 @@ for (i = 0; i < 256; i++) return yield; } +#ifndef DFTABLES +PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION +pcre2_maketables_free(pcre2_general_context *gcontext, const uint8_t *tables) +{ + if (gcontext) + gcontext->memctl.free((void *)tables, gcontext->memctl.memory_data); + else + free((void *)tables); +} +#endif + /* End of pcre2_maketables.c */ diff --git a/src/3rdparty/pcre2/src/pcre2_match.c b/src/3rdparty/pcre2/src/pcre2_match.c index 419561fd64..48e7b9dbb2 100644 --- a/src/3rdparty/pcre2/src/pcre2_match.c +++ b/src/3rdparty/pcre2/src/pcre2_match.c @@ -415,8 +415,7 @@ if (caseless) else #endif - /* Not in UTF mode */ - + /* Not in UTF mode */ { for (; length > 0; length--) { @@ -491,27 +490,32 @@ heap is used for a larger vector. *************************************************/ /* These macros pack up tests that are used for partial matching several times -in the code. We set the "hit end" flag if the pointer is at the end of the -subject and also past the earliest inspected character (i.e. something has been -matched, even if not part of the actual matched string). For hard partial -matching, we then return immediately. The second one is used when we already -know we are past the end of the subject. */ +in the code. The second one is used when we already know we are past the end of +the subject. We set the "hit end" flag if the pointer is at the end of the +subject and either (a) the pointer is past the earliest inspected character +(i.e. something has been matched, even if not part of the actual matched +string), or (b) the pattern contains a lookbehind. These are the conditions for +which adding more characters may allow the current match to continue. + +For hard partial matching, we immediately return a partial match. Otherwise, +carrying on means that a complete match on the current subject will be sought. +A partial match is returned only if no complete match can be found. */ #define CHECK_PARTIAL()\ - if (mb->partial != 0 && Feptr >= mb->end_subject && \ - Feptr > mb->start_used_ptr) \ + if (Feptr >= mb->end_subject) \ { \ - mb->hitend = TRUE; \ - if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \ + SCHECK_PARTIAL(); \ } #define SCHECK_PARTIAL()\ - if (mb->partial != 0 && Feptr > mb->start_used_ptr) \ + if (mb->partial != 0 && \ + (Feptr > mb->start_used_ptr || mb->allowemptypartial)) \ { \ mb->hitend = TRUE; \ if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; \ } + /* These macros are used to implement backtracking. They simulate a recursive call to the match() function by means of a local vector of frames which remember the backtracking points. */ @@ -5127,6 +5131,8 @@ fprintf(stderr, "++ op=%d\n", *Fecode); case OP_ASSERT: case OP_ASSERTBACK: + case OP_ASSERT_NA: + case OP_ASSERTBACK_NA: Lframe_type = GF_NOCAPTURE | Fop; for (;;) { @@ -5412,7 +5418,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); { while (number-- > 0) { - if (Feptr <= mb->start_subject) RRETURN(MATCH_NOMATCH); + if (Feptr <= mb->check_subject) RRETURN(MATCH_NOMATCH); Feptr--; BACKCHAR(Feptr); } @@ -5420,7 +5426,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); else #endif - /* No UTF-8 support, or not in UTF-8 mode: count is byte count */ + /* No UTF-8 support, or not in UTF-8 mode: count is code unit count */ { if ((ptrdiff_t)number > Feptr - mb->start_subject) RRETURN(MATCH_NOMATCH); @@ -5472,15 +5478,16 @@ fprintf(stderr, "++ op=%d\n", *Fecode); /* If we are at the end of an assertion that is a condition, return a match, discarding any intermediate backtracking points. Copy back the - captures into the frame before N so that they are set on return. Doing - this for all assertions, both positive and negative, seems to match what - Perl does. */ + mark setting and the captures into the frame before N so that they are + set on return. Doing this for all assertions, both positive and negative, + seems to match what Perl does. */ if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT) { memcpy((char *)P + offsetof(heapframe, ovector), Fovector, Foffset_top * sizeof(PCRE2_SIZE)); P->offset_top = Foffset_top; + P->mark = Fmark; Fback_frame = (char *)F - (char *)P; RRETURN(MATCH_MATCH); } @@ -5496,10 +5503,20 @@ fprintf(stderr, "++ op=%d\n", *Fecode); case OP_SCOND: break; - /* Positive assertions are like OP_ONCE, except that in addition the + /* Non-atomic positive assertions are like OP_BRA, except that the subject pointer must be put back to where it was at the start of the assertion. */ + case OP_ASSERT_NA: + case OP_ASSERTBACK_NA: + if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr; + Feptr = P->eptr; + break; + + /* Atomic positive assertions are like OP_ONCE, except that in addition + the subject pointer must be put back to where it was at the start of the + assertion. */ + case OP_ASSERT: case OP_ASSERTBACK: if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr; @@ -5640,7 +5657,11 @@ fprintf(stderr, "++ op=%d\n", *Fecode); case OP_EOD: if (Feptr < mb->end_subject) RRETURN(MATCH_NOMATCH); - SCHECK_PARTIAL(); + if (mb->partial != 0) + { + mb->hitend = TRUE; + if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; + } Fecode++; break; @@ -5665,7 +5686,11 @@ fprintf(stderr, "++ op=%d\n", *Fecode); /* Either at end of string or \n before end. */ - SCHECK_PARTIAL(); + if (mb->partial != 0) + { + mb->hitend = TRUE; + if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; + } Fecode++; break; @@ -5743,7 +5768,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); case OP_NOT_WORD_BOUNDARY: case OP_WORD_BOUNDARY: - if (Feptr == mb->start_subject) prev_is_word = FALSE; else + if (Feptr == mb->check_subject) prev_is_word = FALSE; else { PCRE2_SPTR lastptr = Feptr - 1; #ifdef SUPPORT_UNICODE @@ -5946,6 +5971,7 @@ in rrc. */ #define LBL(val) case val: goto L_RM##val; RETURN_SWITCH: +if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr; if (Frdepth == 0) return rrc; /* Exit from the top level */ F = (heapframe *)((char *)F - Fback_frame); /* Backtrack */ mb->cb->callout_flags |= PCRE2_CALLOUT_BACKTRACK; /* Note for callouts */ @@ -5999,9 +6025,9 @@ Arguments: Returns: > 0 => success; value is the number of ovector pairs filled = 0 => success, but ovector is not big enough - -1 => failed to match (PCRE2_ERROR_NOMATCH) - -2 => partial match (PCRE2_ERROR_PARTIAL) - < -2 => some kind of unexpected problem + = -1 => failed to match (PCRE2_ERROR_NOMATCH) + = -2 => partial match (PCRE2_ERROR_PARTIAL) + < -2 => some kind of unexpected problem */ PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION @@ -6014,7 +6040,6 @@ int was_zero_terminated = 0; const uint8_t *start_bits = NULL; const pcre2_real_code *re = (const pcre2_real_code *)code; - BOOL anchored; BOOL firstline; BOOL has_first_cu = FALSE; @@ -6022,6 +6047,11 @@ BOOL has_req_cu = FALSE; BOOL startline; BOOL utf; +#if PCRE2_CODE_UNIT_WIDTH == 8 +BOOL memchr_not_found_first_cu = FALSE; +BOOL memchr_not_found_first_cu2 = FALSE; +#endif + PCRE2_UCHAR first_cu = 0; PCRE2_UCHAR first_cu2 = 0; PCRE2_UCHAR req_cu = 0; @@ -6029,10 +6059,23 @@ PCRE2_UCHAR req_cu2 = 0; PCRE2_SPTR bumpalong_limit; PCRE2_SPTR end_subject; +PCRE2_SPTR true_end_subject; PCRE2_SPTR start_match = subject + start_offset; PCRE2_SPTR req_cu_ptr = start_match - 1; -PCRE2_SPTR start_partial = NULL; -PCRE2_SPTR match_partial = NULL; +PCRE2_SPTR start_partial; +PCRE2_SPTR match_partial; + +#ifdef SUPPORT_JIT +BOOL use_jit; +#endif + +#ifdef SUPPORT_UNICODE +BOOL allow_invalid; +uint32_t fragment_options = 0; +#ifdef SUPPORT_JIT +BOOL jit_checked_utf = FALSE; +#endif +#endif PCRE2_SIZE frame_size; @@ -6059,7 +6102,7 @@ if (length == PCRE2_ZERO_TERMINATED) length = PRIV(strlen)(subject); was_zero_terminated = 1; } -end_subject = subject + length; +true_end_subject = end_subject = subject + length; /* Plausibility checks */ @@ -6095,12 +6138,24 @@ options |= (re->flags & FF) / ((FF & (~FF+1)) / (OO & (~OO+1))); #undef FF #undef OO -/* These two settings are used in the code for checking a UTF string that -follows immediately afterwards. Other values in the mb block are used only -during interpretive processing, not when the JIT support is in use, so they are -set up later. */ +/* If the pattern was successfully studied with JIT support, we will run the +JIT executable instead of the rest of this function. Most options must be set +at compile time for the JIT code to be usable. */ + +#ifdef SUPPORT_JIT +use_jit = (re->executable_jit != NULL && + (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0); +#endif + +/* Initialize UTF parameters. */ utf = (re->overall_options & PCRE2_UTF) != 0; +#ifdef SUPPORT_UNICODE +allow_invalid = (re->overall_options & PCRE2_MATCH_INVALID_UTF) != 0; +#endif + +/* Convert the partial matching flags into an integer. */ + mb->partial = ((options & PCRE2_PARTIAL_HARD) != 0)? 2 : ((options & PCRE2_PARTIAL_SOFT) != 0)? 1 : 0; @@ -6111,88 +6166,107 @@ if (mb->partial != 0 && ((re->overall_options | options) & PCRE2_ENDANCHORED) != 0) return PCRE2_ERROR_BADOPTION; -/* Check a UTF string for validity if required. For 8-bit and 16-bit strings, -we must also check that a starting offset does not point into the middle of a -multiunit character. We check only the portion of the subject that is going to -be inspected during matching - from the offset minus the maximum back reference -to the given length. This saves time when a small part of a large subject is -being matched by the use of a starting offset. Note that the maximum lookbehind -is a number of characters, not code units. */ +/* It is an error to set an offset limit without setting the flag at compile +time. */ -#ifdef SUPPORT_UNICODE -if (utf && (options & PCRE2_NO_UTF_CHECK) == 0) +if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET && + (re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0) + return PCRE2_ERROR_BADOFFSETLIMIT; + +/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT, +free the memory that was obtained. Set the field to NULL for no match cases. */ + +if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0) { - PCRE2_SPTR check_subject = start_match; /* start_match includes offset */ + match_data->memctl.free((void *)match_data->subject, + match_data->memctl.memory_data); + match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT; + } +match_data->subject = NULL; + +/* Zero the error offset in case the first code unit is invalid UTF. */ + +match_data->startchar = 0; + + +/* ============================= JIT matching ============================== */ + +/* Prepare for JIT matching. Check a UTF string for validity unless no check is +requested or invalid UTF can be handled. We check only the portion of the +subject that might be be inspected during matching - from the offset minus the +maximum lookbehind to the given length. This saves time when a small part of a +large subject is being matched by the use of a starting offset. Note that the +maximum lookbehind is a number of characters, not code units. */ - if (start_offset > 0) +#ifdef SUPPORT_JIT +if (use_jit) + { +#ifdef SUPPORT_UNICODE + if (utf && (options & PCRE2_NO_UTF_CHECK) == 0 && !allow_invalid) { #if PCRE2_CODE_UNIT_WIDTH != 32 unsigned int i; +#endif + + /* For 8-bit and 16-bit UTF, check that the first code unit is a valid + character start. */ + +#if PCRE2_CODE_UNIT_WIDTH != 32 if (start_match < end_subject && NOT_FIRSTCU(*start_match)) - return PCRE2_ERROR_BADUTFOFFSET; - for (i = re->max_lookbehind; i > 0 && check_subject > subject; i--) { - check_subject--; - while (check_subject > subject && + if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET; +#if PCRE2_CODE_UNIT_WIDTH == 8 + return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */ +#else + return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */ +#endif + } +#endif /* WIDTH != 32 */ + + /* Move back by the maximum lookbehind, just in case it happens at the very + start of matching. */ + +#if PCRE2_CODE_UNIT_WIDTH != 32 + for (i = re->max_lookbehind; i > 0 && start_match > subject; i--) + { + start_match--; + while (start_match > subject && #if PCRE2_CODE_UNIT_WIDTH == 8 - (*check_subject & 0xc0) == 0x80) + (*start_match & 0xc0) == 0x80) #else /* 16-bit */ - (*check_subject & 0xfc00) == 0xdc00) -#endif /* PCRE2_CODE_UNIT_WIDTH == 8 */ - check_subject--; + (*start_match & 0xfc00) == 0xdc00) +#endif + start_match--; } -#else +#else /* PCRE2_CODE_UNIT_WIDTH != 32 */ + /* In the 32-bit library, one code unit equals one character. However, we cannot just subtract the lookbehind and then compare pointers, because a very large lookbehind could create an invalid pointer. */ if (start_offset >= re->max_lookbehind) - check_subject -= re->max_lookbehind; + start_match -= re->max_lookbehind; else - check_subject = subject; + start_match = subject; #endif /* PCRE2_CODE_UNIT_WIDTH != 32 */ - } - /* Validate the relevant portion of the subject. After an error, adjust the - offset to be an absolute offset in the whole string. */ + /* Validate the relevant portion of the subject. Adjust the offset of an + invalid code point to be an absolute offset in the whole string. */ - match_data->rc = PRIV(valid_utf)(check_subject, - length - (check_subject - subject), &(match_data->startchar)); - if (match_data->rc != 0) - { - match_data->startchar += check_subject - subject; - return match_data->rc; + match_data->rc = PRIV(valid_utf)(start_match, + length - (start_match - subject), &(match_data->startchar)); + if (match_data->rc != 0) + { + match_data->startchar += start_match - subject; + return match_data->rc; + } + jit_checked_utf = TRUE; } - } #endif /* SUPPORT_UNICODE */ -/* It is an error to set an offset limit without setting the flag at compile -time. */ - -if (mcontext != NULL && mcontext->offset_limit != PCRE2_UNSET && - (re->overall_options & PCRE2_USE_OFFSET_LIMIT) == 0) - return PCRE2_ERROR_BADOFFSETLIMIT; - -/* If the match data block was previously used with PCRE2_COPY_MATCHED_SUBJECT, -free the memory that was obtained. Set the field to NULL for no match cases. */ + /* If JIT returns BADOPTION, which means that the selected complete or + partial matching mode was not compiled, fall through to the interpreter. */ -if ((match_data->flags & PCRE2_MD_COPIED_SUBJECT) != 0) - { - match_data->memctl.free((void *)match_data->subject, - match_data->memctl.memory_data); - match_data->flags &= ~PCRE2_MD_COPIED_SUBJECT; - } -match_data->subject = NULL; - -/* If the pattern was successfully studied with JIT support, run the JIT -executable instead of the rest of this function. Most options must be set at -compile time for the JIT code to be usable. Fallback to the normal code path if -an unsupported option is set or if JIT returns BADOPTION (which means that the -selected normal or partial matching mode was not compiled). */ - -#ifdef SUPPORT_JIT -if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0) - { rc = pcre2_jit_match(code, subject, length, start_offset, options, match_data, mcontext); if (rc != PCRE2_ERROR_JIT_BADOPTION) @@ -6209,10 +6283,152 @@ if (re->executable_jit != NULL && (options & ~PUBLIC_JIT_MATCH_OPTIONS) == 0) return rc; } } +#endif /* SUPPORT_JIT */ + +/* ========================= End of JIT matching ========================== */ + + +/* Proceed with non-JIT matching. The default is to allow lookbehinds to the +start of the subject. A UTF check when there is a non-zero offset may change +this. */ + +mb->check_subject = subject; + +/* If a UTF subject string was not checked for validity in the JIT code above, +check it here, and handle support for invalid UTF strings. The check above +happens only when invalid UTF is not supported and PCRE2_NO_CHECK_UTF is unset. +If we get here in those circumstances, it means the subject string is valid, +but for some reason JIT matching was not successful. There is no need to check +the subject again. + +We check only the portion of the subject that might be be inspected during +matching - from the offset minus the maximum lookbehind to the given length. +This saves time when a small part of a large subject is being matched by the +use of a starting offset. Note that the maximum lookbehind is a number of +characters, not code units. + +Note also that support for invalid UTF forces a check, overriding the setting +of PCRE2_NO_CHECK_UTF. */ + +#ifdef SUPPORT_UNICODE +if (utf && +#ifdef SUPPORT_JIT + !jit_checked_utf && +#endif + ((options & PCRE2_NO_UTF_CHECK) == 0 || allow_invalid)) + { +#if PCRE2_CODE_UNIT_WIDTH != 32 + BOOL skipped_bad_start = FALSE; +#endif + + /* For 8-bit and 16-bit UTF, check that the first code unit is a valid + character start. If we are handling invalid UTF, just skip over such code + units. Otherwise, give an appropriate error. */ + +#if PCRE2_CODE_UNIT_WIDTH != 32 + if (allow_invalid) + { + while (start_match < end_subject && NOT_FIRSTCU(*start_match)) + { + start_match++; + skipped_bad_start = TRUE; + } + } + else if (start_match < end_subject && NOT_FIRSTCU(*start_match)) + { + if (start_offset > 0) return PCRE2_ERROR_BADUTFOFFSET; +#if PCRE2_CODE_UNIT_WIDTH == 8 + return PCRE2_ERROR_UTF8_ERR20; /* Isolated 0x80 byte */ +#else + return PCRE2_ERROR_UTF16_ERR3; /* Isolated low surrogate */ +#endif + } +#endif /* WIDTH != 32 */ + + /* The mb->check_subject field points to the start of UTF checking; + lookbehinds can go back no further than this. */ + + mb->check_subject = start_match; + + /* Move back by the maximum lookbehind, just in case it happens at the very + start of matching, but don't do this if we skipped bad 8-bit or 16-bit code + units above. */ + +#if PCRE2_CODE_UNIT_WIDTH != 32 + if (!skipped_bad_start) + { + unsigned int i; + for (i = re->max_lookbehind; i > 0 && mb->check_subject > subject; i--) + { + mb->check_subject--; + while (mb->check_subject > subject && +#if PCRE2_CODE_UNIT_WIDTH == 8 + (*mb->check_subject & 0xc0) == 0x80) +#else /* 16-bit */ + (*mb->check_subject & 0xfc00) == 0xdc00) +#endif + mb->check_subject--; + } + } +#else /* PCRE2_CODE_UNIT_WIDTH != 32 */ + + /* In the 32-bit library, one code unit equals one character. However, + we cannot just subtract the lookbehind and then compare pointers, because + a very large lookbehind could create an invalid pointer. */ + + if (start_offset >= re->max_lookbehind) + mb->check_subject -= re->max_lookbehind; + else + mb->check_subject = subject; +#endif /* PCRE2_CODE_UNIT_WIDTH != 32 */ + + /* Validate the relevant portion of the subject. There's a loop in case we + encounter bad UTF in the characters preceding start_match which we are + scanning because of a lookbehind. */ + + for (;;) + { + match_data->rc = PRIV(valid_utf)(mb->check_subject, + length - (mb->check_subject - subject), &(match_data->startchar)); + + if (match_data->rc == 0) break; /* Valid UTF string */ + + /* Invalid UTF string. Adjust the offset to be an absolute offset in the + whole string. If we are handling invalid UTF strings, set end_subject to + stop before the bad code unit, and set the options to "not end of line". + Otherwise return the error. */ + + match_data->startchar += mb->check_subject - subject; + if (!allow_invalid || match_data->rc > 0) return match_data->rc; + end_subject = subject + match_data->startchar; + + /* If the end precedes start_match, it means there is invalid UTF in the + extra code units we reversed over because of a lookbehind. Advance past the + first bad code unit, and then skip invalid character starting code units in + 8-bit and 16-bit modes, and try again. */ + + if (end_subject < start_match) + { + mb->check_subject = end_subject + 1; +#if PCRE2_CODE_UNIT_WIDTH != 32 + while (mb->check_subject < start_match && NOT_FIRSTCU(*mb->check_subject)) + mb->check_subject++; #endif + } + + /* Otherwise, set the not end of line option, and do the match. */ + + else + { + fragment_options = PCRE2_NOTEOL; + break; + } + } + } +#endif /* SUPPORT_UNICODE */ -/* Carry on with non-JIT matching. A NULL match context means "use a default -context", but we take the memory control functions from the pattern. */ +/* A NULL match context means "use a default context", but we take the memory +control functions from the pattern. */ if (mcontext == NULL) { @@ -6224,8 +6440,8 @@ else mb->memctl = mcontext->memctl; anchored = ((re->overall_options | options) & PCRE2_ANCHORED) != 0; firstline = (re->overall_options & PCRE2_FIRSTLINE) != 0; startline = (re->flags & PCRE2_STARTLINE) != 0; -bumpalong_limit = (mcontext->offset_limit == PCRE2_UNSET)? - end_subject : subject + mcontext->offset_limit; +bumpalong_limit = (mcontext->offset_limit == PCRE2_UNSET)? + true_end_subject : subject + mcontext->offset_limit; /* Initialize and set up the fixed fields in the callout block, with a pointer in the match block. */ @@ -6236,7 +6452,8 @@ cb.subject = subject; cb.subject_length = (PCRE2_SIZE)(end_subject - subject); cb.callout_flags = 0; -/* Fill in the remaining fields in the match block. */ +/* Fill in the remaining fields in the match block, except for moptions, which +gets set later. */ mb->callout = mcontext->callout; mb->callout_data = mcontext->callout_data; @@ -6245,13 +6462,11 @@ mb->start_subject = subject; mb->start_offset = start_offset; mb->end_subject = end_subject; mb->hasthen = (re->flags & PCRE2_HASTHEN) != 0; - -mb->moptions = options; /* Match options */ -mb->poptions = re->overall_options; /* Pattern options */ - +mb->allowemptypartial = (re->max_lookbehind > 0) || + (re->flags & PCRE2_MATCH_EMPTY) != 0; +mb->poptions = re->overall_options; /* Pattern options */ mb->ignore_skip_arg = 0; -mb->mark = mb->nomatch_mark = NULL; /* In case never set */ -mb->hitend = FALSE; +mb->mark = mb->nomatch_mark = NULL; /* In case never set */ /* The name table is needed for finding all the numbers associated with a given name, for condition testing. The code follows the name table. */ @@ -6404,6 +6619,13 @@ if ((re->flags & PCRE2_LASTSET) != 0) /* Loop for handling unanchored repeated matching attempts; for anchored regexs the loop runs just once. */ +#ifdef SUPPORT_UNICODE +FRAGMENT_RESTART: +#endif + +start_partial = match_partial = NULL; +mb->hitend = FALSE; + for(;;) { PCRE2_SPTR new_start_match; @@ -6473,7 +6695,10 @@ for(;;) /* Not anchored. Advance to a unique first code unit if there is one. In 8-bit mode, the use of memchr() gives a big speed up, even though we have to call it twice in caseless mode, in order to find the earliest occurrence - of the character in either of its cases. */ + of the character in either of its cases. If a call to memchr() that + searches the rest of the subject fails to find one case, remember that in + order not to keep on repeating the search. This can make a huge difference + when the strings are very long and only one case is present. */ else { @@ -6487,11 +6712,29 @@ for(;;) (smc = UCHAR21TEST(start_match)) != first_cu && smc != first_cu2) start_match++; + #else /* 8-bit code units */ - PCRE2_SPTR pp1 = - memchr(start_match, first_cu, end_subject-start_match); - PCRE2_SPTR pp2 = - memchr(start_match, first_cu2, end_subject-start_match); + PCRE2_SPTR pp1 = NULL; + PCRE2_SPTR pp2 = NULL; + PCRE2_SIZE cu2size = end_subject - start_match; + + if (!memchr_not_found_first_cu) + { + pp1 = memchr(start_match, first_cu, end_subject - start_match); + if (pp1 == NULL) memchr_not_found_first_cu = TRUE; + else cu2size = pp1 - start_match; + } + + /* If pp1 is not NULL, we have arranged to search only as far as pp1, + to see if the other case is earlier, so we can set "not found" only + when both searches have returned NULL. */ + + if (!memchr_not_found_first_cu2) + { + pp2 = memchr(start_match, first_cu2, cu2size); + memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL); + } + if (pp1 == NULL) start_match = (pp2 == NULL)? end_subject : pp2; else @@ -6523,7 +6766,7 @@ for(;;) we also let the cycle run, because the matching string is legitimately allowed to start with the first code unit of a newline. */ - if (!mb->partial && start_match >= mb->end_subject) + if (mb->partial == 0 && start_match >= mb->end_subject) { rc = MATCH_NOMATCH; break; @@ -6582,7 +6825,7 @@ for(;;) /* See comment above in first_cu checking about the next few lines. */ - if (!mb->partial && start_match >= mb->end_subject) + if (mb->partial == 0 && start_match >= mb->end_subject) { rc = MATCH_NOMATCH; break; @@ -6596,8 +6839,10 @@ for(;;) /* The following two optimizations must be disabled for partial matching. */ - if (!mb->partial) + if (mb->partial == 0) { + PCRE2_SPTR p; + /* The minimum matching length is a lower bound; no string of that length may actually match the pattern. Although the value is, strictly, in characters, we treat it as code units to avoid spending too much time in @@ -6621,60 +6866,57 @@ for(;;) memchr() twice in the caseless case because we only need to check for the presence of the character in either case, not find the first occurrence. + The search can be skipped if the code unit was found later than the + current starting point in a previous iteration of the bumpalong loop. + HOWEVER: when the subject string is very, very long, searching to its end can take a long time, and give bad performance on quite ordinary - patterns. This showed up when somebody was matching something like - /^\d+C/ on a 32-megabyte string... so we don't do this when the string is - sufficiently long. */ + anchored patterns. This showed up when somebody was matching something + like /^\d+C/ on a 32-megabyte string... so we don't do this when the + string is sufficiently long, but it's worth searching a lot more for + unanchored patterns. */ - if (has_req_cu && end_subject - start_match < REQ_CU_MAX) + p = start_match + (has_first_cu? 1:0); + if (has_req_cu && p > req_cu_ptr) { - PCRE2_SPTR p = start_match + (has_first_cu? 1:0); - - /* We don't need to repeat the search if we haven't yet reached the - place we found it last time round the bumpalong loop. */ + PCRE2_SIZE check_length = end_subject - start_match; - if (p > req_cu_ptr) + if (check_length < REQ_CU_MAX || + (!anchored && check_length < REQ_CU_MAX * 1000)) { - if (p < end_subject) + if (req_cu != req_cu2) /* Caseless */ { - if (req_cu != req_cu2) /* Caseless */ - { #if PCRE2_CODE_UNIT_WIDTH != 8 - do - { - uint32_t pp = UCHAR21INCTEST(p); - if (pp == req_cu || pp == req_cu2) { p--; break; } - } - while (p < end_subject); - + while (p < end_subject) + { + uint32_t pp = UCHAR21INCTEST(p); + if (pp == req_cu || pp == req_cu2) { p--; break; } + } #else /* 8-bit code units */ - PCRE2_SPTR pp = p; - p = memchr(pp, req_cu, end_subject - pp); - if (p == NULL) - { - p = memchr(pp, req_cu2, end_subject - pp); - if (p == NULL) p = end_subject; - } -#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */ + PCRE2_SPTR pp = p; + p = memchr(pp, req_cu, end_subject - pp); + if (p == NULL) + { + p = memchr(pp, req_cu2, end_subject - pp); + if (p == NULL) p = end_subject; } +#endif /* PCRE2_CODE_UNIT_WIDTH != 8 */ + } - /* The caseful case */ + /* The caseful case */ - else - { + else + { #if PCRE2_CODE_UNIT_WIDTH != 8 - do - { - if (UCHAR21INCTEST(p) == req_cu) { p--; break; } - } - while (p < end_subject); + while (p < end_subject) + { + if (UCHAR21INCTEST(p) == req_cu) { p--; break; } + } #else /* 8-bit code units */ - p = memchr(p, req_cu, end_subject - p); - if (p == NULL) p = end_subject; + p = memchr(p, req_cu, end_subject - p); + if (p == NULL) p = end_subject; #endif - } } /* If we can't find the required code unit, break the bumpalong loop, @@ -6714,6 +6956,11 @@ for(;;) mb->start_used_ptr = start_match; mb->last_used_ptr = start_match; +#ifdef SUPPORT_UNICODE + mb->moptions = options | fragment_options; +#else + mb->moptions = options; +#endif mb->match_call_count = 0; mb->end_offset_top = 0; mb->skip_arg_count = 0; @@ -6839,6 +7086,68 @@ for(;;) ENDLOOP: +/* If end_subject != true_end_subject, it means we are handling invalid UTF, +and have just processed a non-terminal fragment. If this resulted in no match +or a partial match we must carry on to the next fragment (a partial match is +returned to the caller only at the very end of the subject). A loop is used to +avoid trying to match against empty fragments; if the pattern can match an +empty string it would have done so already. */ + +#ifdef SUPPORT_UNICODE +if (utf && end_subject != true_end_subject && + (rc == MATCH_NOMATCH || rc == PCRE2_ERROR_PARTIAL)) + { + for (;;) + { + /* Advance past the first bad code unit, and then skip invalid character + starting code units in 8-bit and 16-bit modes. */ + + start_match = end_subject + 1; +#if PCRE2_CODE_UNIT_WIDTH != 32 + while (start_match < true_end_subject && NOT_FIRSTCU(*start_match)) + start_match++; +#endif + + /* If we have hit the end of the subject, there isn't another non-empty + fragment, so give up. */ + + if (start_match >= true_end_subject) + { + rc = MATCH_NOMATCH; /* In case it was partial */ + break; + } + + /* Check the rest of the subject */ + + mb->check_subject = start_match; + rc = PRIV(valid_utf)(start_match, length - (start_match - subject), + &(match_data->startchar)); + + /* The rest of the subject is valid UTF. */ + + if (rc == 0) + { + mb->end_subject = end_subject = true_end_subject; + fragment_options = PCRE2_NOTBOL; + goto FRAGMENT_RESTART; + } + + /* A subsequent UTF error has been found; if the next fragment is + non-empty, set up to process it. Otherwise, let the loop advance. */ + + else if (rc < 0) + { + mb->end_subject = end_subject = start_match + match_data->startchar; + if (end_subject > start_match) + { + fragment_options = PCRE2_NOTBOL|PCRE2_NOTEOL; + goto FRAGMENT_RESTART; + } + } + } + } +#endif /* SUPPORT_UNICODE */ + /* Release an enlarged frame vector that is on the heap. */ if (mb->match_frames != mb->stack_frames) diff --git a/src/3rdparty/pcre2/src/pcre2_match_data.c b/src/3rdparty/pcre2/src/pcre2_match_data.c index ccc5f6740e..53e4698707 100644 --- a/src/3rdparty/pcre2/src/pcre2_match_data.c +++ b/src/3rdparty/pcre2/src/pcre2_match_data.c @@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel Original API code Copyright (c) 1997-2012 University of Cambridge - New API code Copyright (c) 2016-2018 University of Cambridge + New API code Copyright (c) 2016-2019 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -150,4 +150,17 @@ pcre2_get_startchar(pcre2_match_data *match_data) return match_data->startchar; } + + +/************************************************* +* Get size of match data block * +*************************************************/ + +PCRE2_EXP_DEFN PCRE2_SIZE PCRE2_CALL_CONVENTION +pcre2_get_match_data_size(pcre2_match_data *match_data) +{ +return offsetof(pcre2_match_data, ovector) + + 2 * (match_data->oveccount) * sizeof(PCRE2_SIZE); +} + /* End of pcre2_match_data.c */ diff --git a/src/3rdparty/pcre2/src/pcre2_study.c b/src/3rdparty/pcre2/src/pcre2_study.c index e883c2eb4c..2883868618 100644 --- a/src/3rdparty/pcre2/src/pcre2_study.c +++ b/src/3rdparty/pcre2/src/pcre2_study.c @@ -88,11 +88,13 @@ Arguments: countptr pointer to call count (to catch over complexity) backref_cache vector for caching back references. +This function is no longer called when the pattern contains (*ACCEPT); however, +the old code for returning -1 is retained, just in case. + Returns: the minimum length -1 \C in UTF-8 mode or (*ACCEPT) or pattern too complicated - or back reference to duplicate name/number -2 internal error (missing capturing bracket) -3 internal error (opcode not listed) */ @@ -103,6 +105,7 @@ find_minlength(const pcre2_real_code *re, PCRE2_SPTR code, int *backref_cache) { int length = -1; +int branchlength = 0; int prev_cap_recno = -1; int prev_cap_d = 0; int prev_recurse_recno = -1; @@ -110,9 +113,9 @@ int prev_recurse_d = 0; uint32_t once_fudge = 0; BOOL had_recurse = FALSE; BOOL dupcapused = (re->flags & PCRE2_DUPCAPUSED) != 0; -recurse_check this_recurse; -int branchlength = 0; +PCRE2_SPTR nextbranch = code + GET(code, 1); PCRE2_UCHAR *cc = (PCRE2_UCHAR *)code + 1 + LINK_SIZE; +recurse_check this_recurse; /* If this is a "could be empty" group, its minimum length is 0. */ @@ -128,16 +131,20 @@ if ((*countptr)++ > 1000) return -1; /* Scan along the opcodes for this branch. If we get to the end of the branch, check the length against that of the other branches. If the accumulated length -passes 16-bits, stop. */ +passes 16-bits, reset to that value and skip the rest of the branch. */ for (;;) { int d, min, recno; - PCRE2_UCHAR *cs, *ce; - PCRE2_UCHAR op = *cc; + PCRE2_UCHAR op, *cs, *ce; - if (branchlength >= UINT16_MAX) return UINT16_MAX; + if (branchlength >= UINT16_MAX) + { + branchlength = UINT16_MAX; + cc = (PCRE2_UCHAR *)nextbranch; + } + op = *cc; switch (op) { case OP_COND: @@ -206,7 +213,9 @@ for (;;) cc += 1 + LINK_SIZE; break; - /* ACCEPT makes things far too complicated; we have to give up. */ + /* ACCEPT makes things far too complicated; we have to give up. In fact, + from 10.34 onwards, if a pattern contains (*ACCEPT), this function is not + used. However, leave the code in place, just in case. */ case OP_ACCEPT: case OP_ASSERT_ACCEPT: @@ -214,9 +223,9 @@ for (;;) /* Reached end of a branch; if it's a ket it is the end of a nested call. If it's ALT it is an alternation in a nested call. If it is END it's - the end of the outer call. All can be handled by the same code. If an - ACCEPT was previously encountered, use the length that was in force at that - time, and pass back the shortest ACCEPT length. */ + the end of the outer call. All can be handled by the same code. If the + length of any branch is zero, there is no need to scan any subsequent + branches. */ case OP_ALT: case OP_KET: @@ -226,7 +235,8 @@ for (;;) case OP_END: if (length < 0 || (!had_recurse && branchlength < length)) length = branchlength; - if (op != OP_ALT) return length; + if (op != OP_ALT || length == 0) return length; + nextbranch = cc + GET(cc, 1); cc += 1 + LINK_SIZE; branchlength = 0; had_recurse = FALSE; @@ -238,6 +248,8 @@ for (;;) case OP_ASSERT_NOT: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: + case OP_ASSERT_NA: + case OP_ASSERTBACK_NA: do cc += GET(cc, 1); while (*cc == OP_ALT); /* Fall through */ @@ -451,15 +463,17 @@ for (;;) If PCRE2_MATCH_UNSET_BACKREF is set, a backreference to an unset bracket matches an empty string (by default it causes a matching failure), so in - that case we must set the minimum length to zero. */ + that case we must set the minimum length to zero. + + For backreferenes, if duplicate numbers are present in the pattern we check + for a reference to a duplicate. If it is, we don't know which version will + be referenced, so we have to set the minimum length to zero. */ - /* Duplicate named pattern back reference. We cannot reliably find a length - for this if duplicate numbers are present in the pattern. */ + /* Duplicate named pattern back reference. */ case OP_DNREF: case OP_DNREFI: - if (dupcapused) return -1; - if ((re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0) + if (!dupcapused && (re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0) { int count = GET2(cc, 1+IMM2_SIZE); PCRE2_UCHAR *slot = @@ -482,28 +496,32 @@ for (;;) ce = cs = (PCRE2_UCHAR *)PRIV(find_bracket)(startcode, utf, recno); if (cs == NULL) return -2; do ce += GET(ce, 1); while (*ce == OP_ALT); - if (cc > cs && cc < ce) /* Simple recursion */ - { - dd = 0; - had_recurse = TRUE; - } - else + + dd = 0; + if (!dupcapused || + (PCRE2_UCHAR *)PRIV(find_bracket)(ce, utf, recno) == NULL) { - recurse_check *r = recurses; - for (r = recurses; r != NULL; r = r->prev) - if (r->group == cs) break; - if (r != NULL) /* Mutual recursion */ + if (cc > cs && cc < ce) /* Simple recursion */ { - dd = 0; had_recurse = TRUE; } else { - this_recurse.prev = recurses; - this_recurse.group = cs; - dd = find_minlength(re, cs, startcode, utf, &this_recurse, - countptr, backref_cache); - if (dd < 0) return dd; + recurse_check *r = recurses; + for (r = recurses; r != NULL; r = r->prev) + if (r->group == cs) break; + if (r != NULL) /* Mutual recursion */ + { + had_recurse = TRUE; + } + else + { + this_recurse.prev = recurses; /* No recursion */ + this_recurse.group = cs; + dd = find_minlength(re, cs, startcode, utf, &this_recurse, + countptr, backref_cache); + if (dd < 0) return dd; + } } } @@ -521,48 +539,51 @@ for (;;) cc += 1 + 2*IMM2_SIZE; goto REPEAT_BACK_REFERENCE; - /* Single back reference. We cannot find a length for this if duplicate - numbers are present in the pattern. */ + /* Single back reference by number. References by name are converted to by + number when there is no duplication. */ case OP_REF: case OP_REFI: - if (dupcapused) return -1; recno = GET2(cc, 1); if (recno <= backref_cache[0] && backref_cache[recno] >= 0) d = backref_cache[recno]; else { int i; + d = 0; + if ((re->overall_options & PCRE2_MATCH_UNSET_BACKREF) == 0) { ce = cs = (PCRE2_UCHAR *)PRIV(find_bracket)(startcode, utf, recno); if (cs == NULL) return -2; do ce += GET(ce, 1); while (*ce == OP_ALT); - if (cc > cs && cc < ce) /* Simple recursion */ - { - d = 0; - had_recurse = TRUE; - } - else + + if (!dupcapused || + (PCRE2_UCHAR *)PRIV(find_bracket)(ce, utf, recno) == NULL) { - recurse_check *r = recurses; - for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break; - if (r != NULL) /* Mutual recursion */ + if (cc > cs && cc < ce) /* Simple recursion */ { - d = 0; had_recurse = TRUE; } else { - this_recurse.prev = recurses; - this_recurse.group = cs; - d = find_minlength(re, cs, startcode, utf, &this_recurse, countptr, - backref_cache); - if (d < 0) return d; + recurse_check *r = recurses; + for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break; + if (r != NULL) /* Mutual recursion */ + { + had_recurse = TRUE; + } + else /* No recursion */ + { + this_recurse.prev = recurses; + this_recurse.group = cs; + d = find_minlength(re, cs, startcode, utf, &this_recurse, countptr, + backref_cache); + if (d < 0) return d; + } } } } - else d = 0; backref_cache[recno] = d; for (i = backref_cache[0] + 1; i < recno; i++) backref_cache[i] = -1; @@ -888,7 +909,7 @@ if (table_limit != 32) for (c = 24; c < 32; c++) re->start_bitmap[c] = 0xff; /************************************************* -* Create bitmap of starting bytes * +* Create bitmap of starting code units * *************************************************/ /* This function scans a compiled unanchored expression recursively and @@ -938,6 +959,9 @@ do { int rc; uint8_t *classmap = NULL; +#ifdef SUPPORT_WIDE_CHARS + PCRE2_UCHAR xclassflags; +#endif switch(*tcode) { @@ -1078,6 +1102,7 @@ do case OP_ONCE: case OP_SCRIPT_RUN: case OP_ASSERT: + case OP_ASSERT_NA: rc = set_start_bits(re, tcode, utf); if (rc == SSB_FAIL || rc == SSB_UNKNOWN) return rc; if (rc == SSB_DONE) try_next = FALSE; else @@ -1120,6 +1145,7 @@ do case OP_ASSERT_NOT: case OP_ASSERTBACK: case OP_ASSERTBACK_NOT: + case OP_ASSERTBACK_NA: do tcode += GET(tcode, 1); while (*tcode == OP_ALT); tcode += 1 + LINK_SIZE; break; @@ -1444,20 +1470,59 @@ do negative XCLASS without a map, give up. If there are no property checks, there must be wide characters on the XCLASS list, because otherwise an XCLASS would not have been created. This means that code points >= 255 - are always potential starters. */ + are potential starters. In the UTF-8 case we can scan them and set bits + for the relevant leading bytes. */ #ifdef SUPPORT_WIDE_CHARS case OP_XCLASS: - if ((tcode[1 + LINK_SIZE] & XCL_HASPROP) != 0 || - (tcode[1 + LINK_SIZE] & (XCL_MAP|XCL_NOT)) == XCL_NOT) + xclassflags = tcode[1 + LINK_SIZE]; + if ((xclassflags & XCL_HASPROP) != 0 || + (xclassflags & (XCL_MAP|XCL_NOT)) == XCL_NOT) return SSB_FAIL; /* We have a positive XCLASS or a negative one without a map. Set up the map pointer if there is one, and fall through. */ - classmap = ((tcode[1 + LINK_SIZE] & XCL_MAP) == 0)? NULL : + classmap = ((xclassflags & XCL_MAP) == 0)? NULL : (uint8_t *)(tcode + 1 + LINK_SIZE + 1); -#endif + + /* In UTF-8 mode, scan the character list and set bits for leading bytes, + then jump to handle the map. */ + +#if PCRE2_CODE_UNIT_WIDTH == 8 + if (utf && (xclassflags & XCL_NOT) == 0) + { + PCRE2_UCHAR b, e; + PCRE2_SPTR p = tcode + 1 + LINK_SIZE + 1 + ((classmap == NULL)? 0:32); + tcode += GET(tcode, 1); + + for (;;) switch (*p++) + { + case XCL_SINGLE: + b = *p++; + while ((*p & 0xc0) == 0x80) p++; + re->start_bitmap[b/8] |= (1u << (b&7)); + break; + + case XCL_RANGE: + b = *p++; + while ((*p & 0xc0) == 0x80) p++; + e = *p++; + while ((*p & 0xc0) == 0x80) p++; + for (; b <= e; b++) + re->start_bitmap[b/8] |= (1u << (b&7)); + break; + + case XCL_END: + goto HANDLE_CLASSMAP; + + default: + return SSB_UNKNOWN; /* Internal error, should not occur */ + } + } +#endif /* SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 */ +#endif /* SUPPORT_WIDE_CHARS */ + /* It seems that the fall through comment must be outside the #ifdef if it is to avoid the gcc compiler warning. */ @@ -1499,6 +1564,9 @@ do greater than 127. In fact, there are only two possible starting bytes for characters in the range 128 - 255. */ +#if defined SUPPORT_WIDE_CHARS && PCRE2_CODE_UNIT_WIDTH == 8 + HANDLE_CLASSMAP: +#endif if (classmap != NULL) { #if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8 @@ -1569,7 +1637,9 @@ return yield; /* This function is handed a compiled expression that it must study to produce information that will speed up the matching. -Argument: points to the compiled expression +Argument: + re points to the compiled expression + Returns: 0 normally; non-zero should never normally occur 1 unknown opcode in set_start_bits 2 missing capturing bracket @@ -1579,7 +1649,6 @@ Returns: 0 normally; non-zero should never normally occur int PRIV(study)(pcre2_real_code *re) { -int min; int count = 0; PCRE2_UCHAR *code; BOOL utf = (re->overall_options & PCRE2_UTF) != 0; @@ -1597,25 +1666,121 @@ if ((re->flags & (PCRE2_FIRSTSET|PCRE2_STARTLINE)) == 0) { int rc = set_start_bits(re, code, utf); if (rc == SSB_UNKNOWN) return 1; - if (rc == SSB_DONE) re->flags |= PCRE2_FIRSTMAPSET; + + /* If a list of starting code units was set up, scan the list to see if only + one or two were listed. Having only one listed is rare because usually a + single starting code unit will have been recognized and PCRE2_FIRSTSET set. + If two are listed, see if they are caseless versions of the same character; + if so we can replace the list with a caseless first code unit. This gives + better performance and is plausibly worth doing for patterns such as [Ww]ord + or (word|WORD). */ + + if (rc == SSB_DONE) + { + int i; + int a = -1; + int b = -1; + uint8_t *p = re->start_bitmap; + uint32_t flags = PCRE2_FIRSTMAPSET; + + for (i = 0; i < 256; p++, i += 8) + { + uint8_t x = *p; + if (x != 0) + { + int c; + uint8_t y = x & (~x + 1); /* Least significant bit */ + if (y != x) goto DONE; /* More than one bit set */ + + /* In the 16-bit and 32-bit libraries, the bit for 0xff means "0xff and + all wide characters", so we cannot use it here. */ + +#if PCRE2_CODE_UNIT_WIDTH != 8 + if (i == 248 && x == 0x80) goto DONE; +#endif + + /* Compute the character value */ + + c = i; + switch (x) + { + case 1: break; + case 2: c += 1; break; case 4: c += 2; break; + case 8: c += 3; break; case 16: c += 4; break; + case 32: c += 5; break; case 64: c += 6; break; + case 128: c += 7; break; + } + + /* c contains the code unit value, in the range 0-255. In 8-bit UTF + mode, only values < 128 can be used. */ + +#if PCRE2_CODE_UNIT_WIDTH == 8 + if (c > 127) goto DONE; +#endif + if (a < 0) a = c; /* First one found */ + else if (b < 0) /* Second one found */ + { + int d = TABLE_GET((unsigned int)c, re->tables + fcc_offset, c); + +#ifdef SUPPORT_UNICODE +#if PCRE2_CODE_UNIT_WIDTH == 8 + if (utf && UCD_CASESET(c) != 0) goto DONE; /* Multiple case set */ +#else /* 16-bit or 32-bit */ + if (UCD_CASESET(c) != 0) goto DONE; /* Multiple case set */ + if (utf && c > 127) d = UCD_OTHERCASE(c); +#endif /* Code width */ +#endif /* SUPPORT_UNICODE */ + + if (d != a) goto DONE; /* Not other case of a */ + b = c; + } + else goto DONE; /* More than two characters found */ + } + } + + /* Replace the start code unit bits with a first code unit, but only if it + is not the same as a required later code unit. This is because a search for + a required code unit starts after an explicit first code unit, but at a + code unit found from the bitmap. Patterns such as /a*a/ don't work + if both the start unit and required unit are the same. */ + + if (a >= 0 && + ( + (re->flags & PCRE2_LASTSET) == 0 || + ( + re->last_codeunit != (uint32_t)a && + (b < 0 || re->last_codeunit != (uint32_t)b) + ) + )) + { + re->first_codeunit = a; + flags = PCRE2_FIRSTSET; + if (b >= 0) flags |= PCRE2_FIRSTCASELESS; + } + + DONE: + re->flags |= flags; + } } /* Find the minimum length of subject string. If the pattern can match an empty -string, the minimum length is already known. If there are more back references -than the size of the vector we are going to cache them in, do nothing. A -pattern that complicated will probably take a long time to analyze and may in -any case turn out to be too complicated. Note that back reference minima are -held as 16-bit numbers. */ - -if ((re->flags & PCRE2_MATCH_EMPTY) == 0 && +string, the minimum length is already known. If the pattern contains (*ACCEPT) +all bets are off, and we don't even try to find a minimum length. If there are +more back references than the size of the vector we are going to cache them in, +do nothing. A pattern that complicated will probably take a long time to +analyze and may in any case turn out to be too complicated. Note that back +reference minima are held as 16-bit numbers. */ + +if ((re->flags & (PCRE2_MATCH_EMPTY|PCRE2_HASACCEPT)) == 0 && re->top_backref <= MAX_CACHE_BACKREF) { + int min; int backref_cache[MAX_CACHE_BACKREF+1]; backref_cache[0] = 0; /* Highest one that is set */ min = find_minlength(re, code, code, utf, NULL, &count, backref_cache); switch(min) { - case -1: /* \C in UTF mode or (*ACCEPT) or over-complex regex */ + case -1: /* \C in UTF mode or over-complex regex */ break; /* Leave minlength unchanged (will be zero) */ case -2: @@ -1625,8 +1790,7 @@ if ((re->flags & PCRE2_MATCH_EMPTY) == 0 && return 3; /* unrecognized opcode */ default: - if (min > UINT16_MAX) min = UINT16_MAX; - re->minlength = min; + re->minlength = (min > UINT16_MAX)? UINT16_MAX : min; break; } } diff --git a/src/3rdparty/pcre2/src/pcre2_tables.c b/src/3rdparty/pcre2/src/pcre2_tables.c index 84019361fc..25531d98c6 100644 --- a/src/3rdparty/pcre2/src/pcre2_tables.c +++ b/src/3rdparty/pcre2/src/pcre2_tables.c @@ -279,6 +279,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Duployan0 STR_D STR_u STR_p STR_l STR_o STR_y STR_a STR_n "\0" #define STRING_Egyptian_Hieroglyphs0 STR_E STR_g STR_y STR_p STR_t STR_i STR_a STR_n STR_UNDERSCORE STR_H STR_i STR_e STR_r STR_o STR_g STR_l STR_y STR_p STR_h STR_s "\0" #define STRING_Elbasan0 STR_E STR_l STR_b STR_a STR_s STR_a STR_n "\0" +#define STRING_Elymaic0 STR_E STR_l STR_y STR_m STR_a STR_i STR_c "\0" #define STRING_Ethiopic0 STR_E STR_t STR_h STR_i STR_o STR_p STR_i STR_c "\0" #define STRING_Georgian0 STR_G STR_e STR_o STR_r STR_g STR_i STR_a STR_n "\0" #define STRING_Glagolitic0 STR_G STR_l STR_a STR_g STR_o STR_l STR_i STR_t STR_i STR_c "\0" @@ -348,6 +349,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Myanmar0 STR_M STR_y STR_a STR_n STR_m STR_a STR_r "\0" #define STRING_N0 STR_N "\0" #define STRING_Nabataean0 STR_N STR_a STR_b STR_a STR_t STR_a STR_e STR_a STR_n "\0" +#define STRING_Nandinagari0 STR_N STR_a STR_n STR_d STR_i STR_n STR_a STR_g STR_a STR_r STR_i "\0" #define STRING_Nd0 STR_N STR_d "\0" #define STRING_New_Tai_Lue0 STR_N STR_e STR_w STR_UNDERSCORE STR_T STR_a STR_i STR_UNDERSCORE STR_L STR_u STR_e "\0" #define STRING_Newa0 STR_N STR_e STR_w STR_a "\0" @@ -355,6 +357,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Nl0 STR_N STR_l "\0" #define STRING_No0 STR_N STR_o "\0" #define STRING_Nushu0 STR_N STR_u STR_s STR_h STR_u "\0" +#define STRING_Nyiakeng_Puachue_Hmong0 STR_N STR_y STR_i STR_a STR_k STR_e STR_n STR_g STR_UNDERSCORE STR_P STR_u STR_a STR_c STR_h STR_u STR_e STR_UNDERSCORE STR_H STR_m STR_o STR_n STR_g "\0" #define STRING_Ogham0 STR_O STR_g STR_h STR_a STR_m "\0" #define STRING_Ol_Chiki0 STR_O STR_l STR_UNDERSCORE STR_C STR_h STR_i STR_k STR_i "\0" #define STRING_Old_Hungarian0 STR_O STR_l STR_d STR_UNDERSCORE STR_H STR_u STR_n STR_g STR_a STR_r STR_i STR_a STR_n "\0" @@ -419,6 +422,7 @@ strings to make sure that UTF-8 support works on EBCDIC platforms. */ #define STRING_Ugaritic0 STR_U STR_g STR_a STR_r STR_i STR_t STR_i STR_c "\0" #define STRING_Unknown0 STR_U STR_n STR_k STR_n STR_o STR_w STR_n "\0" #define STRING_Vai0 STR_V STR_a STR_i "\0" +#define STRING_Wancho0 STR_W STR_a STR_n STR_c STR_h STR_o "\0" #define STRING_Warang_Citi0 STR_W STR_a STR_r STR_a STR_n STR_g STR_UNDERSCORE STR_C STR_i STR_t STR_i "\0" #define STRING_Xan0 STR_X STR_a STR_n "\0" #define STRING_Xps0 STR_X STR_p STR_s "\0" @@ -474,6 +478,7 @@ const char PRIV(utt_names)[] = STRING_Duployan0 STRING_Egyptian_Hieroglyphs0 STRING_Elbasan0 + STRING_Elymaic0 STRING_Ethiopic0 STRING_Georgian0 STRING_Glagolitic0 @@ -543,6 +548,7 @@ const char PRIV(utt_names)[] = STRING_Myanmar0 STRING_N0 STRING_Nabataean0 + STRING_Nandinagari0 STRING_Nd0 STRING_New_Tai_Lue0 STRING_Newa0 @@ -550,6 +556,7 @@ const char PRIV(utt_names)[] = STRING_Nl0 STRING_No0 STRING_Nushu0 + STRING_Nyiakeng_Puachue_Hmong0 STRING_Ogham0 STRING_Ol_Chiki0 STRING_Old_Hungarian0 @@ -614,6 +621,7 @@ const char PRIV(utt_names)[] = STRING_Ugaritic0 STRING_Unknown0 STRING_Vai0 + STRING_Wancho0 STRING_Warang_Citi0 STRING_Xan0 STRING_Xps0 @@ -669,158 +677,162 @@ const ucp_type_table PRIV(utt)[] = { { 299, PT_SC, ucp_Duployan }, { 308, PT_SC, ucp_Egyptian_Hieroglyphs }, { 329, PT_SC, ucp_Elbasan }, - { 337, PT_SC, ucp_Ethiopic }, - { 346, PT_SC, ucp_Georgian }, - { 355, PT_SC, ucp_Glagolitic }, - { 366, PT_SC, ucp_Gothic }, - { 373, PT_SC, ucp_Grantha }, - { 381, PT_SC, ucp_Greek }, - { 387, PT_SC, ucp_Gujarati }, - { 396, PT_SC, ucp_Gunjala_Gondi }, - { 410, PT_SC, ucp_Gurmukhi }, - { 419, PT_SC, ucp_Han }, - { 423, PT_SC, ucp_Hangul }, - { 430, PT_SC, ucp_Hanifi_Rohingya }, - { 446, PT_SC, ucp_Hanunoo }, - { 454, PT_SC, ucp_Hatran }, - { 461, PT_SC, ucp_Hebrew }, - { 468, PT_SC, ucp_Hiragana }, - { 477, PT_SC, ucp_Imperial_Aramaic }, - { 494, PT_SC, ucp_Inherited }, - { 504, PT_SC, ucp_Inscriptional_Pahlavi }, - { 526, PT_SC, ucp_Inscriptional_Parthian }, - { 549, PT_SC, ucp_Javanese }, - { 558, PT_SC, ucp_Kaithi }, - { 565, PT_SC, ucp_Kannada }, - { 573, PT_SC, ucp_Katakana }, - { 582, PT_SC, ucp_Kayah_Li }, - { 591, PT_SC, ucp_Kharoshthi }, - { 602, PT_SC, ucp_Khmer }, - { 608, PT_SC, ucp_Khojki }, - { 615, PT_SC, ucp_Khudawadi }, - { 625, PT_GC, ucp_L }, - { 627, PT_LAMP, 0 }, - { 630, PT_SC, ucp_Lao }, - { 634, PT_SC, ucp_Latin }, - { 640, PT_SC, ucp_Lepcha }, - { 647, PT_SC, ucp_Limbu }, - { 653, PT_SC, ucp_Linear_A }, - { 662, PT_SC, ucp_Linear_B }, - { 671, PT_SC, ucp_Lisu }, - { 676, PT_PC, ucp_Ll }, - { 679, PT_PC, ucp_Lm }, - { 682, PT_PC, ucp_Lo }, - { 685, PT_PC, ucp_Lt }, - { 688, PT_PC, ucp_Lu }, - { 691, PT_SC, ucp_Lycian }, - { 698, PT_SC, ucp_Lydian }, - { 705, PT_GC, ucp_M }, - { 707, PT_SC, ucp_Mahajani }, - { 716, PT_SC, ucp_Makasar }, - { 724, PT_SC, ucp_Malayalam }, - { 734, PT_SC, ucp_Mandaic }, - { 742, PT_SC, ucp_Manichaean }, - { 753, PT_SC, ucp_Marchen }, - { 761, PT_SC, ucp_Masaram_Gondi }, - { 775, PT_PC, ucp_Mc }, - { 778, PT_PC, ucp_Me }, - { 781, PT_SC, ucp_Medefaidrin }, - { 793, PT_SC, ucp_Meetei_Mayek }, - { 806, PT_SC, ucp_Mende_Kikakui }, - { 820, PT_SC, ucp_Meroitic_Cursive }, - { 837, PT_SC, ucp_Meroitic_Hieroglyphs }, - { 858, PT_SC, ucp_Miao }, - { 863, PT_PC, ucp_Mn }, - { 866, PT_SC, ucp_Modi }, - { 871, PT_SC, ucp_Mongolian }, - { 881, PT_SC, ucp_Mro }, - { 885, PT_SC, ucp_Multani }, - { 893, PT_SC, ucp_Myanmar }, - { 901, PT_GC, ucp_N }, - { 903, PT_SC, ucp_Nabataean }, - { 913, PT_PC, ucp_Nd }, - { 916, PT_SC, ucp_New_Tai_Lue }, - { 928, PT_SC, ucp_Newa }, - { 933, PT_SC, ucp_Nko }, - { 937, PT_PC, ucp_Nl }, - { 940, PT_PC, ucp_No }, - { 943, PT_SC, ucp_Nushu }, - { 949, PT_SC, ucp_Ogham }, - { 955, PT_SC, ucp_Ol_Chiki }, - { 964, PT_SC, ucp_Old_Hungarian }, - { 978, PT_SC, ucp_Old_Italic }, - { 989, PT_SC, ucp_Old_North_Arabian }, - { 1007, PT_SC, ucp_Old_Permic }, - { 1018, PT_SC, ucp_Old_Persian }, - { 1030, PT_SC, ucp_Old_Sogdian }, - { 1042, PT_SC, ucp_Old_South_Arabian }, - { 1060, PT_SC, ucp_Old_Turkic }, - { 1071, PT_SC, ucp_Oriya }, - { 1077, PT_SC, ucp_Osage }, - { 1083, PT_SC, ucp_Osmanya }, - { 1091, PT_GC, ucp_P }, - { 1093, PT_SC, ucp_Pahawh_Hmong }, - { 1106, PT_SC, ucp_Palmyrene }, - { 1116, PT_SC, ucp_Pau_Cin_Hau }, - { 1128, PT_PC, ucp_Pc }, - { 1131, PT_PC, ucp_Pd }, - { 1134, PT_PC, ucp_Pe }, - { 1137, PT_PC, ucp_Pf }, - { 1140, PT_SC, ucp_Phags_Pa }, - { 1149, PT_SC, ucp_Phoenician }, - { 1160, PT_PC, ucp_Pi }, - { 1163, PT_PC, ucp_Po }, - { 1166, PT_PC, ucp_Ps }, - { 1169, PT_SC, ucp_Psalter_Pahlavi }, - { 1185, PT_SC, ucp_Rejang }, - { 1192, PT_SC, ucp_Runic }, - { 1198, PT_GC, ucp_S }, - { 1200, PT_SC, ucp_Samaritan }, - { 1210, PT_SC, ucp_Saurashtra }, - { 1221, PT_PC, ucp_Sc }, - { 1224, PT_SC, ucp_Sharada }, - { 1232, PT_SC, ucp_Shavian }, - { 1240, PT_SC, ucp_Siddham }, - { 1248, PT_SC, ucp_SignWriting }, - { 1260, PT_SC, ucp_Sinhala }, - { 1268, PT_PC, ucp_Sk }, - { 1271, PT_PC, ucp_Sm }, - { 1274, PT_PC, ucp_So }, - { 1277, PT_SC, ucp_Sogdian }, - { 1285, PT_SC, ucp_Sora_Sompeng }, - { 1298, PT_SC, ucp_Soyombo }, - { 1306, PT_SC, ucp_Sundanese }, - { 1316, PT_SC, ucp_Syloti_Nagri }, - { 1329, PT_SC, ucp_Syriac }, - { 1336, PT_SC, ucp_Tagalog }, - { 1344, PT_SC, ucp_Tagbanwa }, - { 1353, PT_SC, ucp_Tai_Le }, - { 1360, PT_SC, ucp_Tai_Tham }, - { 1369, PT_SC, ucp_Tai_Viet }, - { 1378, PT_SC, ucp_Takri }, - { 1384, PT_SC, ucp_Tamil }, - { 1390, PT_SC, ucp_Tangut }, - { 1397, PT_SC, ucp_Telugu }, - { 1404, PT_SC, ucp_Thaana }, - { 1411, PT_SC, ucp_Thai }, - { 1416, PT_SC, ucp_Tibetan }, - { 1424, PT_SC, ucp_Tifinagh }, - { 1433, PT_SC, ucp_Tirhuta }, - { 1441, PT_SC, ucp_Ugaritic }, - { 1450, PT_SC, ucp_Unknown }, - { 1458, PT_SC, ucp_Vai }, - { 1462, PT_SC, ucp_Warang_Citi }, - { 1474, PT_ALNUM, 0 }, - { 1478, PT_PXSPACE, 0 }, - { 1482, PT_SPACE, 0 }, - { 1486, PT_UCNC, 0 }, - { 1490, PT_WORD, 0 }, - { 1494, PT_SC, ucp_Yi }, - { 1497, PT_GC, ucp_Z }, - { 1499, PT_SC, ucp_Zanabazar_Square }, - { 1516, PT_PC, ucp_Zl }, - { 1519, PT_PC, ucp_Zp }, - { 1522, PT_PC, ucp_Zs } + { 337, PT_SC, ucp_Elymaic }, + { 345, PT_SC, ucp_Ethiopic }, + { 354, PT_SC, ucp_Georgian }, + { 363, PT_SC, ucp_Glagolitic }, + { 374, PT_SC, ucp_Gothic }, + { 381, PT_SC, ucp_Grantha }, + { 389, PT_SC, ucp_Greek }, + { 395, PT_SC, ucp_Gujarati }, + { 404, PT_SC, ucp_Gunjala_Gondi }, + { 418, PT_SC, ucp_Gurmukhi }, + { 427, PT_SC, ucp_Han }, + { 431, PT_SC, ucp_Hangul }, + { 438, PT_SC, ucp_Hanifi_Rohingya }, + { 454, PT_SC, ucp_Hanunoo }, + { 462, PT_SC, ucp_Hatran }, + { 469, PT_SC, ucp_Hebrew }, + { 476, PT_SC, ucp_Hiragana }, + { 485, PT_SC, ucp_Imperial_Aramaic }, + { 502, PT_SC, ucp_Inherited }, + { 512, PT_SC, ucp_Inscriptional_Pahlavi }, + { 534, PT_SC, ucp_Inscriptional_Parthian }, + { 557, PT_SC, ucp_Javanese }, + { 566, PT_SC, ucp_Kaithi }, + { 573, PT_SC, ucp_Kannada }, + { 581, PT_SC, ucp_Katakana }, + { 590, PT_SC, ucp_Kayah_Li }, + { 599, PT_SC, ucp_Kharoshthi }, + { 610, PT_SC, ucp_Khmer }, + { 616, PT_SC, ucp_Khojki }, + { 623, PT_SC, ucp_Khudawadi }, + { 633, PT_GC, ucp_L }, + { 635, PT_LAMP, 0 }, + { 638, PT_SC, ucp_Lao }, + { 642, PT_SC, ucp_Latin }, + { 648, PT_SC, ucp_Lepcha }, + { 655, PT_SC, ucp_Limbu }, + { 661, PT_SC, ucp_Linear_A }, + { 670, PT_SC, ucp_Linear_B }, + { 679, PT_SC, ucp_Lisu }, + { 684, PT_PC, ucp_Ll }, + { 687, PT_PC, ucp_Lm }, + { 690, PT_PC, ucp_Lo }, + { 693, PT_PC, ucp_Lt }, + { 696, PT_PC, ucp_Lu }, + { 699, PT_SC, ucp_Lycian }, + { 706, PT_SC, ucp_Lydian }, + { 713, PT_GC, ucp_M }, + { 715, PT_SC, ucp_Mahajani }, + { 724, PT_SC, ucp_Makasar }, + { 732, PT_SC, ucp_Malayalam }, + { 742, PT_SC, ucp_Mandaic }, + { 750, PT_SC, ucp_Manichaean }, + { 761, PT_SC, ucp_Marchen }, + { 769, PT_SC, ucp_Masaram_Gondi }, + { 783, PT_PC, ucp_Mc }, + { 786, PT_PC, ucp_Me }, + { 789, PT_SC, ucp_Medefaidrin }, + { 801, PT_SC, ucp_Meetei_Mayek }, + { 814, PT_SC, ucp_Mende_Kikakui }, + { 828, PT_SC, ucp_Meroitic_Cursive }, + { 845, PT_SC, ucp_Meroitic_Hieroglyphs }, + { 866, PT_SC, ucp_Miao }, + { 871, PT_PC, ucp_Mn }, + { 874, PT_SC, ucp_Modi }, + { 879, PT_SC, ucp_Mongolian }, + { 889, PT_SC, ucp_Mro }, + { 893, PT_SC, ucp_Multani }, + { 901, PT_SC, ucp_Myanmar }, + { 909, PT_GC, ucp_N }, + { 911, PT_SC, ucp_Nabataean }, + { 921, PT_SC, ucp_Nandinagari }, + { 933, PT_PC, ucp_Nd }, + { 936, PT_SC, ucp_New_Tai_Lue }, + { 948, PT_SC, ucp_Newa }, + { 953, PT_SC, ucp_Nko }, + { 957, PT_PC, ucp_Nl }, + { 960, PT_PC, ucp_No }, + { 963, PT_SC, ucp_Nushu }, + { 969, PT_SC, ucp_Nyiakeng_Puachue_Hmong }, + { 992, PT_SC, ucp_Ogham }, + { 998, PT_SC, ucp_Ol_Chiki }, + { 1007, PT_SC, ucp_Old_Hungarian }, + { 1021, PT_SC, ucp_Old_Italic }, + { 1032, PT_SC, ucp_Old_North_Arabian }, + { 1050, PT_SC, ucp_Old_Permic }, + { 1061, PT_SC, ucp_Old_Persian }, + { 1073, PT_SC, ucp_Old_Sogdian }, + { 1085, PT_SC, ucp_Old_South_Arabian }, + { 1103, PT_SC, ucp_Old_Turkic }, + { 1114, PT_SC, ucp_Oriya }, + { 1120, PT_SC, ucp_Osage }, + { 1126, PT_SC, ucp_Osmanya }, + { 1134, PT_GC, ucp_P }, + { 1136, PT_SC, ucp_Pahawh_Hmong }, + { 1149, PT_SC, ucp_Palmyrene }, + { 1159, PT_SC, ucp_Pau_Cin_Hau }, + { 1171, PT_PC, ucp_Pc }, + { 1174, PT_PC, ucp_Pd }, + { 1177, PT_PC, ucp_Pe }, + { 1180, PT_PC, ucp_Pf }, + { 1183, PT_SC, ucp_Phags_Pa }, + { 1192, PT_SC, ucp_Phoenician }, + { 1203, PT_PC, ucp_Pi }, + { 1206, PT_PC, ucp_Po }, + { 1209, PT_PC, ucp_Ps }, + { 1212, PT_SC, ucp_Psalter_Pahlavi }, + { 1228, PT_SC, ucp_Rejang }, + { 1235, PT_SC, ucp_Runic }, + { 1241, PT_GC, ucp_S }, + { 1243, PT_SC, ucp_Samaritan }, + { 1253, PT_SC, ucp_Saurashtra }, + { 1264, PT_PC, ucp_Sc }, + { 1267, PT_SC, ucp_Sharada }, + { 1275, PT_SC, ucp_Shavian }, + { 1283, PT_SC, ucp_Siddham }, + { 1291, PT_SC, ucp_SignWriting }, + { 1303, PT_SC, ucp_Sinhala }, + { 1311, PT_PC, ucp_Sk }, + { 1314, PT_PC, ucp_Sm }, + { 1317, PT_PC, ucp_So }, + { 1320, PT_SC, ucp_Sogdian }, + { 1328, PT_SC, ucp_Sora_Sompeng }, + { 1341, PT_SC, ucp_Soyombo }, + { 1349, PT_SC, ucp_Sundanese }, + { 1359, PT_SC, ucp_Syloti_Nagri }, + { 1372, PT_SC, ucp_Syriac }, + { 1379, PT_SC, ucp_Tagalog }, + { 1387, PT_SC, ucp_Tagbanwa }, + { 1396, PT_SC, ucp_Tai_Le }, + { 1403, PT_SC, ucp_Tai_Tham }, + { 1412, PT_SC, ucp_Tai_Viet }, + { 1421, PT_SC, ucp_Takri }, + { 1427, PT_SC, ucp_Tamil }, + { 1433, PT_SC, ucp_Tangut }, + { 1440, PT_SC, ucp_Telugu }, + { 1447, PT_SC, ucp_Thaana }, + { 1454, PT_SC, ucp_Thai }, + { 1459, PT_SC, ucp_Tibetan }, + { 1467, PT_SC, ucp_Tifinagh }, + { 1476, PT_SC, ucp_Tirhuta }, + { 1484, PT_SC, ucp_Ugaritic }, + { 1493, PT_SC, ucp_Unknown }, + { 1501, PT_SC, ucp_Vai }, + { 1505, PT_SC, ucp_Wancho }, + { 1512, PT_SC, ucp_Warang_Citi }, + { 1524, PT_ALNUM, 0 }, + { 1528, PT_PXSPACE, 0 }, + { 1532, PT_SPACE, 0 }, + { 1536, PT_UCNC, 0 }, + { 1540, PT_WORD, 0 }, + { 1544, PT_SC, ucp_Yi }, + { 1547, PT_GC, ucp_Z }, + { 1549, PT_SC, ucp_Zanabazar_Square }, + { 1566, PT_PC, ucp_Zl }, + { 1569, PT_PC, ucp_Zp }, + { 1572, PT_PC, ucp_Zs } }; const size_t PRIV(utt_size) = sizeof(PRIV(utt)) / sizeof(ucp_type_table); diff --git a/src/3rdparty/pcre2/src/pcre2_ucd.c b/src/3rdparty/pcre2/src/pcre2_ucd.c index cc53c24001..55ba03bd43 100644 --- a/src/3rdparty/pcre2/src/pcre2_ucd.c +++ b/src/3rdparty/pcre2/src/pcre2_ucd.c @@ -20,7 +20,7 @@ needed. */ /* Unicode character database. */ /* This file was autogenerated by the MultiStage2.py script. */ -/* Total size: 97152 bytes, block size: 128. */ +/* Total size: 99316 bytes, block size: 128. */ /* The tables herein are needed only when UCP support is built, and in PCRE2 that happens automatically with UTF support. @@ -39,7 +39,7 @@ const uint16_t PRIV(ucd_stage2)[] = {0}; const uint32_t PRIV(ucd_caseless_sets)[] = {0}; #else -const char *PRIV(unicode_version) = "11.0.0"; +const char *PRIV(unicode_version) = "12.1.0"; /* If the 32-bit library is run in non-32-bit mode, character values greater than 0x10ffff may be encountered. For these we set up a @@ -116,7 +116,7 @@ set of decimal digits. It is used to ensure that all the digits in a script run come from the same set. */ const uint32_t PRIV(ucd_digit_sets)[] = { - 61, /* Number of subsequent values */ + 63, /* Number of subsequent values */ 0x00039, 0x00669, 0x006f9, 0x007c9, 0x0096f, 0x009ef, 0x00a6f, 0x00aef, 0x00b6f, 0x00bef, 0x00c6f, 0x00cef, 0x00d6f, 0x00def, 0x00e59, 0x00ed9, 0x00f29, 0x01049, 0x01099, 0x017e9, 0x01819, 0x0194f, 0x019d9, 0x01a89, @@ -124,7 +124,7 @@ const uint32_t PRIV(ucd_digit_sets)[] = { 0x0a9d9, 0x0a9f9, 0x0aa59, 0x0abf9, 0x0ff19, 0x104a9, 0x10d39, 0x1106f, 0x110f9, 0x1113f, 0x111d9, 0x112f9, 0x11459, 0x114d9, 0x11659, 0x116c9, 0x11739, 0x118e9, 0x11c59, 0x11d59, 0x11da9, 0x16a69, 0x16b59, 0x1d7d7, - 0x1d7e1, 0x1d7eb, 0x1d7f5, 0x1d7ff, 0x1e959, + 0x1d7e1, 0x1d7eb, 0x1d7f5, 0x1d7ff, 0x1e149, 0x1e2f9, 0x1e959, }; /* This vector is a list of lists of scripts for the Script Extension @@ -145,38 +145,42 @@ const uint8_t PRIV(ucd_script_sets)[] = { /* 31 */ 13, 34, 0, /* 34 */ 13, 118, 0, /* 37 */ 15, 107, 0, - /* 40 */ 15, 100, 0, - /* 43 */ 15, 54, 0, - /* 46 */ 17, 34, 0, - /* 49 */ 107, 54, 0, - /* 52 */ 21, 108, 0, - /* 55 */ 22, 129, 0, - /* 58 */ 27, 30, 0, - /* 61 */ 38, 65, 0, - /* 64 */ 1, 50, 56, 0, - /* 68 */ 3, 96, 49, 0, - /* 72 */ 96, 39, 53, 0, - /* 76 */ 12, 110, 36, 0, - /* 80 */ 15, 107, 29, 0, - /* 84 */ 15, 107, 34, 0, - /* 88 */ 23, 27, 30, 0, - /* 92 */ 69, 34, 39, 0, - /* 96 */ 1, 144, 50, 56, 0, - /* 101 */ 3, 15, 107, 29, 0, - /* 106 */ 7, 25, 52, 51, 0, - /* 111 */ 15, 142, 85, 111, 0, - /* 116 */ 4, 24, 23, 27, 30, 0, - /* 122 */ 4, 24, 23, 27, 30, 61, 0, - /* 129 */ 15, 29, 37, 44, 54, 55, 0, - /* 136 */ 132, 1, 95, 112, 121, 144, 148, 50, 0, - /* 145 */ 15, 142, 21, 22, 108, 85, 111, 114, 109, 102, 124, 0, - /* 157 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 54, 55, 124, 0, - /* 170 */ 15, 142, 21, 22, 108, 29, 85, 111, 114, 109, 102, 124, 0, - /* 183 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 100, 54, 55, 124, 0, - /* 197 */ 15, 142, 21, 22, 108, 29, 85, 111, 37, 114, 109, 102, 124, 0, - /* 211 */ 3, 15, 142, 143, 107, 21, 22, 29, 111, 37, 44, 109, 48, 49, 102, 54, 55, 124, 0, - /* 230 */ 3, 15, 142, 143, 107, 21, 22, 29, 35, 111, 37, 44, 109, 48, 49, 102, 54, 55, 124, 0, - /* 250 */ + /* 40 */ 15, 150, 0, + /* 43 */ 15, 100, 0, + /* 46 */ 15, 54, 0, + /* 49 */ 17, 34, 0, + /* 52 */ 107, 54, 0, + /* 55 */ 21, 108, 0, + /* 58 */ 22, 129, 0, + /* 61 */ 27, 30, 0, + /* 64 */ 29, 150, 0, + /* 67 */ 34, 38, 0, + /* 70 */ 38, 65, 0, + /* 73 */ 1, 50, 56, 0, + /* 77 */ 3, 96, 49, 0, + /* 81 */ 96, 39, 53, 0, + /* 85 */ 12, 110, 36, 0, + /* 89 */ 15, 107, 29, 0, + /* 93 */ 15, 107, 34, 0, + /* 97 */ 23, 27, 30, 0, + /* 101 */ 69, 34, 39, 0, + /* 105 */ 1, 144, 50, 56, 0, + /* 110 */ 3, 15, 107, 29, 0, + /* 115 */ 7, 25, 52, 51, 0, + /* 120 */ 15, 142, 85, 111, 0, + /* 125 */ 4, 24, 23, 27, 30, 0, + /* 131 */ 4, 24, 23, 27, 30, 61, 0, + /* 138 */ 15, 29, 37, 44, 54, 55, 0, + /* 145 */ 132, 1, 95, 112, 121, 144, 148, 50, 0, + /* 154 */ 3, 15, 107, 29, 150, 44, 55, 124, 0, + /* 163 */ 15, 142, 21, 22, 108, 85, 111, 114, 109, 102, 124, 0, + /* 175 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 54, 55, 124, 0, + /* 188 */ 3, 15, 107, 21, 22, 29, 34, 37, 44, 100, 54, 55, 124, 0, + /* 202 */ 15, 142, 21, 22, 108, 29, 85, 111, 114, 150, 109, 102, 124, 0, + /* 216 */ 15, 142, 21, 22, 108, 29, 85, 111, 37, 114, 150, 109, 102, 124, 0, + /* 231 */ 3, 15, 142, 143, 138, 107, 21, 22, 29, 111, 37, 150, 44, 109, 48, 49, 102, 54, 55, 124, 0, + /* 252 */ 3, 15, 142, 143, 138, 107, 21, 22, 29, 35, 111, 37, 150, 44, 109, 48, 49, 102, 54, 55, 124, 0, + /* 274 */ }; /* These are the main two-stage UCD tables. The fields in each record are: @@ -185,7 +189,7 @@ offset to multichar other cases or zero (8 bits), offset to other case or zero (32 bits, signed), script extension (16 bits, signed), and a dummy 16-bit field to make the whole thing a multiple of 4 bytes. */ -const ucd_record PRIV(ucd_records)[] = { /* 11136 bytes, record size 12 */ +const ucd_record PRIV(ucd_records)[] = { /* 11508 bytes, record size 12 */ { 10, 0, 2, 0, 0, 10, 256, }, /* 0 */ { 10, 0, 2, 0, 0, 10, 0, }, /* 1 */ { 10, 0, 1, 0, 0, 10, 0, }, /* 2 */ @@ -288,832 +292,863 @@ const ucd_record PRIV(ucd_records)[] = { /* 11136 bytes, record size 12 */ { 34, 5, 12, 0, -214, 34, 0, }, /* 99 */ { 34, 5, 12, 0, 10727, 34, 0, }, /* 100 */ { 34, 5, 12, 0, -218, 34, 0, }, /* 101 */ - { 34, 5, 12, 0, 42282, 34, 0, }, /* 102 */ - { 34, 5, 12, 0, -69, 34, 0, }, /* 103 */ - { 34, 5, 12, 0, -217, 34, 0, }, /* 104 */ - { 34, 5, 12, 0, -71, 34, 0, }, /* 105 */ - { 34, 5, 12, 0, -219, 34, 0, }, /* 106 */ - { 34, 5, 12, 0, 42261, 34, 0, }, /* 107 */ - { 34, 5, 12, 0, 42258, 34, 0, }, /* 108 */ - { 34, 6, 12, 0, 0, 34, 0, }, /* 109 */ - { 10, 6, 12, 0, 0, 10, 0, }, /* 110 */ - { 4, 24, 12, 0, 0, 4, 0, }, /* 111 */ - { 28, 12, 3, 0, 0, 28, 0, }, /* 112 */ - { 28, 12, 3, 0, 0, 20, 0, }, /* 113 */ - { 28, 12, 3, 21, 116, 20, 0, }, /* 114 */ - { 28, 12, 3, 0, 0, 34, 0, }, /* 115 */ - { 20, 9, 12, 0, 1, 20, 0, }, /* 116 */ - { 20, 5, 12, 0, -1, 20, 0, }, /* 117 */ - { 20, 24, 12, 0, 0, 20, 0, }, /* 118 */ - { 0, 2, 12, 0, 0, 0, 0, }, /* 119 */ - { 20, 6, 12, 0, 0, 20, 0, }, /* 120 */ - { 20, 5, 12, 0, 130, 20, 0, }, /* 121 */ - { 20, 9, 12, 0, 116, 20, 0, }, /* 122 */ - { 20, 9, 12, 0, 38, 20, 0, }, /* 123 */ - { 20, 9, 12, 0, 37, 20, 0, }, /* 124 */ - { 20, 9, 12, 0, 64, 20, 0, }, /* 125 */ - { 20, 9, 12, 0, 63, 20, 0, }, /* 126 */ - { 20, 5, 12, 0, 0, 20, 0, }, /* 127 */ - { 20, 9, 12, 0, 32, 20, 0, }, /* 128 */ - { 20, 9, 12, 34, 32, 20, 0, }, /* 129 */ - { 20, 9, 12, 59, 32, 20, 0, }, /* 130 */ - { 20, 9, 12, 38, 32, 20, 0, }, /* 131 */ - { 20, 9, 12, 21, 32, 20, 0, }, /* 132 */ - { 20, 9, 12, 51, 32, 20, 0, }, /* 133 */ - { 20, 9, 12, 26, 32, 20, 0, }, /* 134 */ - { 20, 9, 12, 47, 32, 20, 0, }, /* 135 */ - { 20, 9, 12, 55, 32, 20, 0, }, /* 136 */ - { 20, 9, 12, 30, 32, 20, 0, }, /* 137 */ - { 20, 9, 12, 43, 32, 20, 0, }, /* 138 */ - { 20, 9, 12, 96, 32, 20, 0, }, /* 139 */ - { 20, 5, 12, 0, -38, 20, 0, }, /* 140 */ - { 20, 5, 12, 0, -37, 20, 0, }, /* 141 */ - { 20, 5, 12, 0, -32, 20, 0, }, /* 142 */ - { 20, 5, 12, 34, -32, 20, 0, }, /* 143 */ - { 20, 5, 12, 59, -32, 20, 0, }, /* 144 */ - { 20, 5, 12, 38, -32, 20, 0, }, /* 145 */ - { 20, 5, 12, 21, -116, 20, 0, }, /* 146 */ - { 20, 5, 12, 51, -32, 20, 0, }, /* 147 */ - { 20, 5, 12, 26, -775, 20, 0, }, /* 148 */ - { 20, 5, 12, 47, -32, 20, 0, }, /* 149 */ - { 20, 5, 12, 55, -32, 20, 0, }, /* 150 */ - { 20, 5, 12, 30, 1, 20, 0, }, /* 151 */ - { 20, 5, 12, 30, -32, 20, 0, }, /* 152 */ - { 20, 5, 12, 43, -32, 20, 0, }, /* 153 */ - { 20, 5, 12, 96, -32, 20, 0, }, /* 154 */ - { 20, 5, 12, 0, -64, 20, 0, }, /* 155 */ - { 20, 5, 12, 0, -63, 20, 0, }, /* 156 */ - { 20, 9, 12, 0, 8, 20, 0, }, /* 157 */ - { 20, 5, 12, 34, -30, 20, 0, }, /* 158 */ - { 20, 5, 12, 38, -25, 20, 0, }, /* 159 */ - { 20, 9, 12, 0, 0, 20, 0, }, /* 160 */ - { 20, 5, 12, 43, -15, 20, 0, }, /* 161 */ - { 20, 5, 12, 47, -22, 20, 0, }, /* 162 */ - { 20, 5, 12, 0, -8, 20, 0, }, /* 163 */ - { 11, 9, 12, 0, 1, 11, 0, }, /* 164 */ - { 11, 5, 12, 0, -1, 11, 0, }, /* 165 */ - { 20, 5, 12, 51, -54, 20, 0, }, /* 166 */ - { 20, 5, 12, 55, -48, 20, 0, }, /* 167 */ - { 20, 5, 12, 0, 7, 20, 0, }, /* 168 */ - { 20, 5, 12, 0, -116, 20, 0, }, /* 169 */ - { 20, 9, 12, 38, -60, 20, 0, }, /* 170 */ - { 20, 5, 12, 59, -64, 20, 0, }, /* 171 */ - { 20, 25, 12, 0, 0, 20, 0, }, /* 172 */ - { 20, 9, 12, 0, -7, 20, 0, }, /* 173 */ - { 20, 9, 12, 0, -130, 20, 0, }, /* 174 */ - { 13, 9, 12, 0, 80, 13, 0, }, /* 175 */ - { 13, 9, 12, 0, 32, 13, 0, }, /* 176 */ - { 13, 9, 12, 63, 32, 13, 0, }, /* 177 */ - { 13, 9, 12, 67, 32, 13, 0, }, /* 178 */ - { 13, 9, 12, 71, 32, 13, 0, }, /* 179 */ - { 13, 9, 12, 75, 32, 13, 0, }, /* 180 */ - { 13, 9, 12, 79, 32, 13, 0, }, /* 181 */ - { 13, 9, 12, 84, 32, 13, 0, }, /* 182 */ - { 13, 5, 12, 0, -32, 13, 0, }, /* 183 */ - { 13, 5, 12, 63, -32, 13, 0, }, /* 184 */ - { 13, 5, 12, 67, -32, 13, 0, }, /* 185 */ - { 13, 5, 12, 71, -32, 13, 0, }, /* 186 */ - { 13, 5, 12, 75, -32, 13, 0, }, /* 187 */ - { 13, 5, 12, 79, -32, 13, 0, }, /* 188 */ - { 13, 5, 12, 84, -32, 13, 0, }, /* 189 */ - { 13, 5, 12, 0, -80, 13, 0, }, /* 190 */ - { 13, 9, 12, 0, 1, 13, 0, }, /* 191 */ - { 13, 5, 12, 0, -1, 13, 0, }, /* 192 */ - { 13, 9, 12, 88, 1, 13, 0, }, /* 193 */ - { 13, 5, 12, 88, -1, 13, 0, }, /* 194 */ - { 13, 26, 12, 0, 0, 13, 0, }, /* 195 */ - { 13, 12, 3, 0, 0, -34, 0, }, /* 196 */ - { 13, 12, 3, 0, 0, -28, 0, }, /* 197 */ - { 28, 12, 3, 0, 0, -31, 0, }, /* 198 */ - { 13, 11, 3, 0, 0, 13, 0, }, /* 199 */ - { 13, 9, 12, 0, 15, 13, 0, }, /* 200 */ - { 13, 5, 12, 0, -15, 13, 0, }, /* 201 */ - { 2, 9, 12, 0, 48, 2, 0, }, /* 202 */ - { 2, 6, 12, 0, 0, 2, 0, }, /* 203 */ - { 2, 21, 12, 0, 0, 2, 0, }, /* 204 */ - { 2, 5, 12, 0, 0, 2, 0, }, /* 205 */ - { 2, 5, 12, 0, -48, 2, 0, }, /* 206 */ - { 10, 21, 12, 0, 0, -13, 0, }, /* 207 */ - { 2, 17, 12, 0, 0, 2, 0, }, /* 208 */ - { 2, 26, 12, 0, 0, 2, 0, }, /* 209 */ - { 2, 23, 12, 0, 0, 2, 0, }, /* 210 */ - { 26, 12, 3, 0, 0, 26, 0, }, /* 211 */ - { 26, 17, 12, 0, 0, 26, 0, }, /* 212 */ - { 26, 21, 12, 0, 0, 26, 0, }, /* 213 */ - { 26, 7, 12, 0, 0, 26, 0, }, /* 214 */ - { 1, 1, 4, 0, 0, 1, 0, }, /* 215 */ - { 10, 1, 4, 0, 0, 10, 0, }, /* 216 */ - { 1, 25, 12, 0, 0, 1, 0, }, /* 217 */ - { 1, 21, 12, 0, 0, 1, 0, }, /* 218 */ - { 1, 23, 12, 0, 0, 1, 0, }, /* 219 */ - { 10, 21, 12, 0, 0, -96, 0, }, /* 220 */ - { 1, 26, 12, 0, 0, 1, 0, }, /* 221 */ - { 1, 12, 3, 0, 0, 1, 0, }, /* 222 */ - { 1, 1, 2, 0, 0, -64, 0, }, /* 223 */ - { 1, 7, 12, 0, 0, 1, 0, }, /* 224 */ - { 10, 6, 12, 0, 0, -136, 0, }, /* 225 */ - { 28, 12, 3, 0, 0, -7, 0, }, /* 226 */ - { 1, 13, 12, 0, 0, -10, 0, }, /* 227 */ - { 1, 21, 12, 0, 0, -4, 0, }, /* 228 */ - { 1, 6, 12, 0, 0, 1, 0, }, /* 229 */ - { 1, 13, 12, 0, 0, 1, 0, }, /* 230 */ - { 50, 21, 12, 0, 0, 50, 0, }, /* 231 */ - { 50, 1, 4, 0, 0, 50, 0, }, /* 232 */ - { 50, 7, 12, 0, 0, 50, 0, }, /* 233 */ - { 50, 12, 3, 0, 0, 50, 0, }, /* 234 */ - { 56, 7, 12, 0, 0, 56, 0, }, /* 235 */ - { 56, 12, 3, 0, 0, 56, 0, }, /* 236 */ - { 64, 13, 12, 0, 0, 64, 0, }, /* 237 */ - { 64, 7, 12, 0, 0, 64, 0, }, /* 238 */ - { 64, 12, 3, 0, 0, 64, 0, }, /* 239 */ - { 64, 6, 12, 0, 0, 64, 0, }, /* 240 */ - { 64, 26, 12, 0, 0, 64, 0, }, /* 241 */ - { 64, 21, 12, 0, 0, 64, 0, }, /* 242 */ - { 64, 23, 12, 0, 0, 64, 0, }, /* 243 */ - { 90, 7, 12, 0, 0, 90, 0, }, /* 244 */ - { 90, 12, 3, 0, 0, 90, 0, }, /* 245 */ - { 90, 6, 12, 0, 0, 90, 0, }, /* 246 */ - { 90, 21, 12, 0, 0, 90, 0, }, /* 247 */ - { 95, 7, 12, 0, 0, 95, 0, }, /* 248 */ - { 95, 12, 3, 0, 0, 95, 0, }, /* 249 */ - { 95, 21, 12, 0, 0, 95, 0, }, /* 250 */ - { 15, 12, 3, 0, 0, 15, 0, }, /* 251 */ - { 15, 10, 5, 0, 0, 15, 0, }, /* 252 */ - { 15, 7, 12, 0, 0, 15, 0, }, /* 253 */ - { 28, 12, 3, 0, 0, -183, 0, }, /* 254 */ - { 28, 12, 3, 0, 0, -157, 0, }, /* 255 */ - { 10, 21, 12, 0, 0, -211, 0, }, /* 256 */ - { 10, 21, 12, 0, 0, -230, 0, }, /* 257 */ - { 15, 13, 12, 0, 0, -111, 0, }, /* 258 */ - { 15, 21, 12, 0, 0, 15, 0, }, /* 259 */ - { 15, 6, 12, 0, 0, 15, 0, }, /* 260 */ - { 3, 7, 12, 0, 0, 3, 0, }, /* 261 */ - { 3, 12, 3, 0, 0, 3, 0, }, /* 262 */ - { 3, 10, 5, 0, 0, 3, 0, }, /* 263 */ - { 3, 10, 3, 0, 0, 3, 0, }, /* 264 */ - { 3, 13, 12, 0, 0, -68, 0, }, /* 265 */ - { 3, 23, 12, 0, 0, 3, 0, }, /* 266 */ - { 3, 15, 12, 0, 0, 3, 0, }, /* 267 */ - { 3, 26, 12, 0, 0, 3, 0, }, /* 268 */ - { 3, 21, 12, 0, 0, 3, 0, }, /* 269 */ - { 22, 12, 3, 0, 0, 22, 0, }, /* 270 */ - { 22, 10, 5, 0, 0, 22, 0, }, /* 271 */ - { 22, 7, 12, 0, 0, 22, 0, }, /* 272 */ - { 22, 13, 12, 0, 0, -55, 0, }, /* 273 */ - { 22, 21, 12, 0, 0, 22, 0, }, /* 274 */ - { 21, 12, 3, 0, 0, 21, 0, }, /* 275 */ - { 21, 10, 5, 0, 0, 21, 0, }, /* 276 */ - { 21, 7, 12, 0, 0, 21, 0, }, /* 277 */ - { 21, 13, 12, 0, 0, -52, 0, }, /* 278 */ - { 21, 21, 12, 0, 0, 21, 0, }, /* 279 */ - { 21, 23, 12, 0, 0, 21, 0, }, /* 280 */ - { 44, 12, 3, 0, 0, 44, 0, }, /* 281 */ - { 44, 10, 5, 0, 0, 44, 0, }, /* 282 */ - { 44, 7, 12, 0, 0, 44, 0, }, /* 283 */ - { 44, 10, 3, 0, 0, 44, 0, }, /* 284 */ - { 44, 13, 12, 0, 0, 44, 0, }, /* 285 */ - { 44, 26, 12, 0, 0, 44, 0, }, /* 286 */ - { 44, 15, 12, 0, 0, 44, 0, }, /* 287 */ - { 54, 12, 3, 0, 0, 54, 0, }, /* 288 */ - { 54, 7, 12, 0, 0, 54, 0, }, /* 289 */ - { 54, 10, 3, 0, 0, 54, 0, }, /* 290 */ - { 54, 10, 5, 0, 0, 54, 0, }, /* 291 */ - { 54, 13, 12, 0, 0, -49, 0, }, /* 292 */ - { 54, 15, 12, 0, 0, -49, 0, }, /* 293 */ - { 54, 26, 12, 0, 0, -49, 0, }, /* 294 */ - { 54, 26, 12, 0, 0, 54, 0, }, /* 295 */ - { 54, 23, 12, 0, 0, 54, 0, }, /* 296 */ - { 55, 12, 3, 0, 0, 55, 0, }, /* 297 */ - { 55, 10, 5, 0, 0, 55, 0, }, /* 298 */ - { 55, 7, 12, 0, 0, 55, 0, }, /* 299 */ - { 55, 13, 12, 0, 0, 55, 0, }, /* 300 */ - { 55, 15, 12, 0, 0, 55, 0, }, /* 301 */ - { 55, 26, 12, 0, 0, 55, 0, }, /* 302 */ - { 29, 7, 12, 0, 0, 29, 0, }, /* 303 */ - { 29, 12, 3, 0, 0, 29, 0, }, /* 304 */ - { 29, 10, 5, 0, 0, 29, 0, }, /* 305 */ - { 29, 21, 12, 0, 0, 29, 0, }, /* 306 */ - { 29, 10, 3, 0, 0, 29, 0, }, /* 307 */ - { 29, 13, 12, 0, 0, 29, 0, }, /* 308 */ - { 37, 12, 3, 0, 0, 37, 0, }, /* 309 */ - { 37, 10, 5, 0, 0, 37, 0, }, /* 310 */ - { 37, 7, 12, 0, 0, 37, 0, }, /* 311 */ - { 37, 10, 3, 0, 0, 37, 0, }, /* 312 */ - { 37, 7, 4, 0, 0, 37, 0, }, /* 313 */ - { 37, 26, 12, 0, 0, 37, 0, }, /* 314 */ - { 37, 15, 12, 0, 0, 37, 0, }, /* 315 */ - { 37, 13, 12, 0, 0, 37, 0, }, /* 316 */ - { 48, 10, 5, 0, 0, 48, 0, }, /* 317 */ - { 48, 7, 12, 0, 0, 48, 0, }, /* 318 */ - { 48, 12, 3, 0, 0, 48, 0, }, /* 319 */ - { 48, 10, 3, 0, 0, 48, 0, }, /* 320 */ - { 48, 13, 12, 0, 0, 48, 0, }, /* 321 */ - { 48, 21, 12, 0, 0, 48, 0, }, /* 322 */ - { 57, 7, 12, 0, 0, 57, 0, }, /* 323 */ - { 57, 12, 3, 0, 0, 57, 0, }, /* 324 */ - { 57, 7, 5, 0, 0, 57, 0, }, /* 325 */ - { 57, 6, 12, 0, 0, 57, 0, }, /* 326 */ - { 57, 21, 12, 0, 0, 57, 0, }, /* 327 */ - { 57, 13, 12, 0, 0, 57, 0, }, /* 328 */ - { 33, 7, 12, 0, 0, 33, 0, }, /* 329 */ - { 33, 12, 3, 0, 0, 33, 0, }, /* 330 */ - { 33, 7, 5, 0, 0, 33, 0, }, /* 331 */ - { 33, 6, 12, 0, 0, 33, 0, }, /* 332 */ - { 33, 13, 12, 0, 0, 33, 0, }, /* 333 */ - { 58, 7, 12, 0, 0, 58, 0, }, /* 334 */ - { 58, 26, 12, 0, 0, 58, 0, }, /* 335 */ - { 58, 21, 12, 0, 0, 58, 0, }, /* 336 */ - { 58, 12, 3, 0, 0, 58, 0, }, /* 337 */ - { 58, 13, 12, 0, 0, 58, 0, }, /* 338 */ - { 58, 15, 12, 0, 0, 58, 0, }, /* 339 */ - { 58, 22, 12, 0, 0, 58, 0, }, /* 340 */ - { 58, 18, 12, 0, 0, 58, 0, }, /* 341 */ - { 58, 10, 5, 0, 0, 58, 0, }, /* 342 */ - { 39, 7, 12, 0, 0, 39, 0, }, /* 343 */ - { 39, 10, 12, 0, 0, 39, 0, }, /* 344 */ - { 39, 12, 3, 0, 0, 39, 0, }, /* 345 */ - { 39, 10, 5, 0, 0, 39, 0, }, /* 346 */ - { 39, 13, 12, 0, 0, -72, 0, }, /* 347 */ - { 39, 21, 12, 0, 0, 39, 0, }, /* 348 */ - { 39, 13, 12, 0, 0, 39, 0, }, /* 349 */ - { 39, 26, 12, 0, 0, 39, 0, }, /* 350 */ - { 17, 9, 12, 0, 7264, 17, 0, }, /* 351 */ - { 17, 5, 12, 0, 3008, 17, 0, }, /* 352 */ - { 10, 21, 12, 0, 0, -46, 0, }, /* 353 */ - { 17, 6, 12, 0, 0, 17, 0, }, /* 354 */ - { 24, 7, 6, 0, 0, 24, 0, }, /* 355 */ - { 24, 7, 7, 0, 0, 24, 0, }, /* 356 */ - { 24, 7, 8, 0, 0, 24, 0, }, /* 357 */ - { 16, 7, 12, 0, 0, 16, 0, }, /* 358 */ - { 16, 12, 3, 0, 0, 16, 0, }, /* 359 */ - { 16, 21, 12, 0, 0, 16, 0, }, /* 360 */ - { 16, 15, 12, 0, 0, 16, 0, }, /* 361 */ - { 16, 26, 12, 0, 0, 16, 0, }, /* 362 */ - { 9, 9, 12, 0, 38864, 9, 0, }, /* 363 */ - { 9, 9, 12, 0, 8, 9, 0, }, /* 364 */ - { 9, 5, 12, 0, -8, 9, 0, }, /* 365 */ - { 8, 17, 12, 0, 0, 8, 0, }, /* 366 */ - { 8, 7, 12, 0, 0, 8, 0, }, /* 367 */ - { 8, 21, 12, 0, 0, 8, 0, }, /* 368 */ - { 41, 29, 12, 0, 0, 41, 0, }, /* 369 */ - { 41, 7, 12, 0, 0, 41, 0, }, /* 370 */ - { 41, 22, 12, 0, 0, 41, 0, }, /* 371 */ - { 41, 18, 12, 0, 0, 41, 0, }, /* 372 */ - { 46, 7, 12, 0, 0, 46, 0, }, /* 373 */ - { 46, 14, 12, 0, 0, 46, 0, }, /* 374 */ - { 51, 7, 12, 0, 0, 51, 0, }, /* 375 */ - { 51, 12, 3, 0, 0, 51, 0, }, /* 376 */ - { 25, 7, 12, 0, 0, 25, 0, }, /* 377 */ - { 25, 12, 3, 0, 0, 25, 0, }, /* 378 */ - { 10, 21, 12, 0, 0, -106, 0, }, /* 379 */ - { 7, 7, 12, 0, 0, 7, 0, }, /* 380 */ - { 7, 12, 3, 0, 0, 7, 0, }, /* 381 */ - { 52, 7, 12, 0, 0, 52, 0, }, /* 382 */ - { 52, 12, 3, 0, 0, 52, 0, }, /* 383 */ - { 32, 7, 12, 0, 0, 32, 0, }, /* 384 */ - { 32, 12, 3, 0, 0, 32, 0, }, /* 385 */ - { 32, 10, 5, 0, 0, 32, 0, }, /* 386 */ - { 32, 21, 12, 0, 0, 32, 0, }, /* 387 */ - { 32, 6, 12, 0, 0, 32, 0, }, /* 388 */ - { 32, 23, 12, 0, 0, 32, 0, }, /* 389 */ - { 32, 13, 12, 0, 0, 32, 0, }, /* 390 */ - { 32, 15, 12, 0, 0, 32, 0, }, /* 391 */ - { 38, 21, 12, 0, 0, 38, 0, }, /* 392 */ - { 10, 21, 12, 0, 0, -61, 0, }, /* 393 */ - { 38, 17, 12, 0, 0, 38, 0, }, /* 394 */ - { 38, 12, 3, 0, 0, 38, 0, }, /* 395 */ - { 38, 1, 2, 0, 0, 38, 0, }, /* 396 */ - { 38, 13, 12, 0, 0, 38, 0, }, /* 397 */ - { 38, 7, 12, 0, 0, 38, 0, }, /* 398 */ - { 38, 6, 12, 0, 0, 38, 0, }, /* 399 */ - { 35, 7, 12, 0, 0, 35, 0, }, /* 400 */ - { 35, 12, 3, 0, 0, 35, 0, }, /* 401 */ - { 35, 10, 5, 0, 0, 35, 0, }, /* 402 */ - { 35, 26, 12, 0, 0, 35, 0, }, /* 403 */ - { 35, 21, 12, 0, 0, 35, 0, }, /* 404 */ - { 35, 13, 12, 0, 0, 35, 0, }, /* 405 */ - { 53, 7, 12, 0, 0, 53, 0, }, /* 406 */ - { 40, 7, 12, 0, 0, 40, 0, }, /* 407 */ - { 40, 13, 12, 0, 0, 40, 0, }, /* 408 */ - { 40, 15, 12, 0, 0, 40, 0, }, /* 409 */ - { 40, 26, 12, 0, 0, 40, 0, }, /* 410 */ - { 32, 26, 12, 0, 0, 32, 0, }, /* 411 */ - { 6, 7, 12, 0, 0, 6, 0, }, /* 412 */ - { 6, 12, 3, 0, 0, 6, 0, }, /* 413 */ - { 6, 10, 5, 0, 0, 6, 0, }, /* 414 */ - { 6, 21, 12, 0, 0, 6, 0, }, /* 415 */ - { 91, 7, 12, 0, 0, 91, 0, }, /* 416 */ - { 91, 10, 5, 0, 0, 91, 0, }, /* 417 */ - { 91, 12, 3, 0, 0, 91, 0, }, /* 418 */ - { 91, 10, 12, 0, 0, 91, 0, }, /* 419 */ - { 91, 13, 12, 0, 0, 91, 0, }, /* 420 */ - { 91, 21, 12, 0, 0, 91, 0, }, /* 421 */ - { 91, 6, 12, 0, 0, 91, 0, }, /* 422 */ - { 28, 11, 3, 0, 0, 28, 0, }, /* 423 */ - { 62, 12, 3, 0, 0, 62, 0, }, /* 424 */ - { 62, 10, 5, 0, 0, 62, 0, }, /* 425 */ - { 62, 7, 12, 0, 0, 62, 0, }, /* 426 */ - { 62, 13, 12, 0, 0, 62, 0, }, /* 427 */ - { 62, 21, 12, 0, 0, 62, 0, }, /* 428 */ - { 62, 26, 12, 0, 0, 62, 0, }, /* 429 */ - { 76, 12, 3, 0, 0, 76, 0, }, /* 430 */ - { 76, 10, 5, 0, 0, 76, 0, }, /* 431 */ - { 76, 7, 12, 0, 0, 76, 0, }, /* 432 */ - { 76, 13, 12, 0, 0, 76, 0, }, /* 433 */ - { 93, 7, 12, 0, 0, 93, 0, }, /* 434 */ - { 93, 12, 3, 0, 0, 93, 0, }, /* 435 */ - { 93, 10, 5, 0, 0, 93, 0, }, /* 436 */ - { 93, 21, 12, 0, 0, 93, 0, }, /* 437 */ - { 70, 7, 12, 0, 0, 70, 0, }, /* 438 */ - { 70, 10, 5, 0, 0, 70, 0, }, /* 439 */ - { 70, 12, 3, 0, 0, 70, 0, }, /* 440 */ - { 70, 21, 12, 0, 0, 70, 0, }, /* 441 */ - { 70, 13, 12, 0, 0, 70, 0, }, /* 442 */ - { 73, 13, 12, 0, 0, 73, 0, }, /* 443 */ - { 73, 7, 12, 0, 0, 73, 0, }, /* 444 */ - { 73, 6, 12, 0, 0, 73, 0, }, /* 445 */ - { 73, 21, 12, 0, 0, 73, 0, }, /* 446 */ - { 13, 5, 12, 63, -6222, 13, 0, }, /* 447 */ - { 13, 5, 12, 67, -6221, 13, 0, }, /* 448 */ - { 13, 5, 12, 71, -6212, 13, 0, }, /* 449 */ - { 13, 5, 12, 75, -6210, 13, 0, }, /* 450 */ - { 13, 5, 12, 79, -6210, 13, 0, }, /* 451 */ - { 13, 5, 12, 79, -6211, 13, 0, }, /* 452 */ - { 13, 5, 12, 84, -6204, 13, 0, }, /* 453 */ - { 13, 5, 12, 88, -6180, 13, 0, }, /* 454 */ - { 13, 5, 12, 108, 35267, 13, 0, }, /* 455 */ - { 17, 9, 12, 0, -3008, 17, 0, }, /* 456 */ - { 76, 21, 12, 0, 0, 76, 0, }, /* 457 */ - { 28, 12, 3, 0, 0, -101, 0, }, /* 458 */ - { 28, 12, 3, 0, 0, 15, 0, }, /* 459 */ - { 10, 21, 12, 0, 0, -37, 0, }, /* 460 */ - { 28, 12, 3, 0, 0, -16, 0, }, /* 461 */ - { 28, 12, 3, 0, 0, -40, 0, }, /* 462 */ - { 28, 12, 3, 0, 0, -129, 0, }, /* 463 */ - { 10, 10, 5, 0, 0, -16, 0, }, /* 464 */ - { 10, 7, 12, 0, 0, 15, 0, }, /* 465 */ - { 10, 7, 12, 0, 0, -16, 0, }, /* 466 */ - { 10, 10, 5, 0, 0, -37, 0, }, /* 467 */ - { 28, 12, 3, 0, 0, -80, 0, }, /* 468 */ - { 10, 10, 5, 0, 0, 3, 0, }, /* 469 */ - { 28, 12, 3, 0, 0, -37, 0, }, /* 470 */ - { 13, 5, 12, 0, 0, 13, 0, }, /* 471 */ - { 13, 6, 12, 0, 0, 13, 0, }, /* 472 */ - { 34, 5, 12, 0, 35332, 34, 0, }, /* 473 */ - { 34, 5, 12, 0, 3814, 34, 0, }, /* 474 */ - { 34, 9, 12, 92, 1, 34, 0, }, /* 475 */ - { 34, 5, 12, 92, -1, 34, 0, }, /* 476 */ - { 34, 5, 12, 92, -58, 34, 0, }, /* 477 */ - { 34, 9, 12, 0, -7615, 34, 0, }, /* 478 */ - { 20, 5, 12, 0, 8, 20, 0, }, /* 479 */ - { 20, 9, 12, 0, -8, 20, 0, }, /* 480 */ - { 20, 5, 12, 0, 74, 20, 0, }, /* 481 */ - { 20, 5, 12, 0, 86, 20, 0, }, /* 482 */ - { 20, 5, 12, 0, 100, 20, 0, }, /* 483 */ - { 20, 5, 12, 0, 128, 20, 0, }, /* 484 */ - { 20, 5, 12, 0, 112, 20, 0, }, /* 485 */ - { 20, 5, 12, 0, 126, 20, 0, }, /* 486 */ - { 20, 8, 12, 0, -8, 20, 0, }, /* 487 */ - { 20, 5, 12, 0, 9, 20, 0, }, /* 488 */ - { 20, 9, 12, 0, -74, 20, 0, }, /* 489 */ - { 20, 8, 12, 0, -9, 20, 0, }, /* 490 */ - { 20, 5, 12, 21, -7173, 20, 0, }, /* 491 */ - { 20, 9, 12, 0, -86, 20, 0, }, /* 492 */ - { 20, 9, 12, 0, -100, 20, 0, }, /* 493 */ - { 20, 9, 12, 0, -112, 20, 0, }, /* 494 */ - { 20, 9, 12, 0, -128, 20, 0, }, /* 495 */ - { 20, 9, 12, 0, -126, 20, 0, }, /* 496 */ - { 28, 1, 3, 0, 0, 28, 0, }, /* 497 */ - { 28, 1, 13, 0, 0, 28, 0, }, /* 498 */ - { 10, 27, 2, 0, 0, 10, 0, }, /* 499 */ - { 10, 28, 2, 0, 0, 10, 0, }, /* 500 */ - { 10, 21, 14, 0, 0, 10, 0, }, /* 501 */ - { 0, 2, 2, 0, 0, 0, 0, }, /* 502 */ - { 28, 12, 3, 0, 0, -84, 0, }, /* 503 */ - { 10, 9, 12, 0, 0, 10, 0, }, /* 504 */ - { 10, 5, 12, 0, 0, 10, 0, }, /* 505 */ - { 20, 9, 12, 96, -7517, 20, 0, }, /* 506 */ - { 34, 9, 12, 100, -8383, 34, 0, }, /* 507 */ - { 34, 9, 12, 104, -8262, 34, 0, }, /* 508 */ - { 34, 9, 12, 0, 28, 34, 0, }, /* 509 */ - { 10, 7, 12, 0, 0, 10, 0, }, /* 510 */ - { 10, 5, 14, 0, 0, 10, 0, }, /* 511 */ - { 34, 5, 12, 0, -28, 34, 0, }, /* 512 */ - { 34, 14, 12, 0, 16, 34, 0, }, /* 513 */ - { 34, 14, 12, 0, -16, 34, 0, }, /* 514 */ - { 34, 14, 12, 0, 0, 34, 0, }, /* 515 */ - { 10, 25, 14, 0, 0, 10, 0, }, /* 516 */ - { 10, 26, 12, 0, 26, 10, 0, }, /* 517 */ - { 10, 26, 14, 0, 26, 10, 0, }, /* 518 */ - { 10, 26, 12, 0, -26, 10, 0, }, /* 519 */ - { 5, 26, 12, 0, 0, 5, 0, }, /* 520 */ - { 18, 9, 12, 0, 48, 18, 0, }, /* 521 */ - { 18, 5, 12, 0, -48, 18, 0, }, /* 522 */ - { 34, 9, 12, 0, -10743, 34, 0, }, /* 523 */ - { 34, 9, 12, 0, -3814, 34, 0, }, /* 524 */ - { 34, 9, 12, 0, -10727, 34, 0, }, /* 525 */ - { 34, 5, 12, 0, -10795, 34, 0, }, /* 526 */ - { 34, 5, 12, 0, -10792, 34, 0, }, /* 527 */ - { 34, 9, 12, 0, -10780, 34, 0, }, /* 528 */ - { 34, 9, 12, 0, -10749, 34, 0, }, /* 529 */ - { 34, 9, 12, 0, -10783, 34, 0, }, /* 530 */ - { 34, 9, 12, 0, -10782, 34, 0, }, /* 531 */ - { 34, 9, 12, 0, -10815, 34, 0, }, /* 532 */ - { 11, 5, 12, 0, 0, 11, 0, }, /* 533 */ - { 11, 26, 12, 0, 0, 11, 0, }, /* 534 */ - { 11, 12, 3, 0, 0, 11, 0, }, /* 535 */ - { 11, 21, 12, 0, 0, 11, 0, }, /* 536 */ - { 11, 15, 12, 0, 0, 11, 0, }, /* 537 */ - { 17, 5, 12, 0, -7264, 17, 0, }, /* 538 */ - { 59, 7, 12, 0, 0, 59, 0, }, /* 539 */ - { 59, 6, 12, 0, 0, 59, 0, }, /* 540 */ - { 59, 21, 12, 0, 0, 59, 0, }, /* 541 */ - { 59, 12, 3, 0, 0, 59, 0, }, /* 542 */ - { 13, 12, 3, 0, 0, 13, 0, }, /* 543 */ - { 10, 21, 12, 0, 0, -28, 0, }, /* 544 */ - { 23, 26, 12, 0, 0, 23, 0, }, /* 545 */ - { 10, 21, 12, 0, 0, -122, 0, }, /* 546 */ - { 10, 21, 12, 0, 0, -116, 0, }, /* 547 */ - { 23, 6, 12, 0, 0, 23, 0, }, /* 548 */ - { 10, 7, 12, 0, 0, 23, 0, }, /* 549 */ - { 23, 14, 12, 0, 0, 23, 0, }, /* 550 */ - { 10, 22, 12, 0, 0, -122, 0, }, /* 551 */ - { 10, 18, 12, 0, 0, -122, 0, }, /* 552 */ - { 10, 26, 12, 0, 0, -116, 0, }, /* 553 */ - { 10, 17, 12, 0, 0, -116, 0, }, /* 554 */ - { 10, 22, 12, 0, 0, -116, 0, }, /* 555 */ - { 10, 18, 12, 0, 0, -116, 0, }, /* 556 */ - { 28, 12, 3, 0, 0, -19, 0, }, /* 557 */ - { 24, 10, 3, 0, 0, 24, 0, }, /* 558 */ - { 10, 17, 14, 0, 0, -116, 0, }, /* 559 */ - { 10, 6, 12, 0, 0, -58, 0, }, /* 560 */ - { 10, 7, 12, 0, 0, -88, 0, }, /* 561 */ - { 10, 21, 14, 0, 0, -88, 0, }, /* 562 */ - { 10, 26, 12, 0, 0, 23, 0, }, /* 563 */ - { 27, 7, 12, 0, 0, 27, 0, }, /* 564 */ - { 28, 12, 3, 0, 0, -58, 0, }, /* 565 */ - { 10, 24, 12, 0, 0, -58, 0, }, /* 566 */ - { 27, 6, 12, 0, 0, 27, 0, }, /* 567 */ - { 10, 17, 12, 0, 0, -58, 0, }, /* 568 */ - { 30, 7, 12, 0, 0, 30, 0, }, /* 569 */ - { 30, 6, 12, 0, 0, 30, 0, }, /* 570 */ - { 4, 7, 12, 0, 0, 4, 0, }, /* 571 */ - { 24, 7, 12, 0, 0, 24, 0, }, /* 572 */ - { 10, 15, 12, 0, 0, 23, 0, }, /* 573 */ - { 24, 26, 12, 0, 0, 24, 0, }, /* 574 */ - { 10, 26, 14, 0, 0, 23, 0, }, /* 575 */ - { 30, 26, 12, 0, 0, 30, 0, }, /* 576 */ - { 23, 7, 12, 0, 0, 23, 0, }, /* 577 */ - { 61, 7, 12, 0, 0, 61, 0, }, /* 578 */ - { 61, 6, 12, 0, 0, 61, 0, }, /* 579 */ - { 61, 26, 12, 0, 0, 61, 0, }, /* 580 */ - { 86, 7, 12, 0, 0, 86, 0, }, /* 581 */ - { 86, 6, 12, 0, 0, 86, 0, }, /* 582 */ - { 86, 21, 12, 0, 0, 86, 0, }, /* 583 */ - { 77, 7, 12, 0, 0, 77, 0, }, /* 584 */ - { 77, 6, 12, 0, 0, 77, 0, }, /* 585 */ - { 77, 21, 12, 0, 0, 77, 0, }, /* 586 */ - { 77, 13, 12, 0, 0, 77, 0, }, /* 587 */ - { 13, 9, 12, 108, 1, 13, 0, }, /* 588 */ - { 13, 5, 12, 108, -35267, 13, 0, }, /* 589 */ - { 13, 7, 12, 0, 0, 13, 0, }, /* 590 */ - { 13, 21, 12, 0, 0, 13, 0, }, /* 591 */ - { 79, 7, 12, 0, 0, 79, 0, }, /* 592 */ - { 79, 14, 12, 0, 0, 79, 0, }, /* 593 */ - { 79, 12, 3, 0, 0, 79, 0, }, /* 594 */ - { 79, 21, 12, 0, 0, 79, 0, }, /* 595 */ - { 34, 9, 12, 0, -35332, 34, 0, }, /* 596 */ - { 34, 9, 12, 0, -42280, 34, 0, }, /* 597 */ - { 34, 9, 12, 0, -42308, 34, 0, }, /* 598 */ - { 34, 9, 12, 0, -42319, 34, 0, }, /* 599 */ - { 34, 9, 12, 0, -42315, 34, 0, }, /* 600 */ - { 34, 9, 12, 0, -42305, 34, 0, }, /* 601 */ - { 34, 9, 12, 0, -42258, 34, 0, }, /* 602 */ - { 34, 9, 12, 0, -42282, 34, 0, }, /* 603 */ - { 34, 9, 12, 0, -42261, 34, 0, }, /* 604 */ - { 34, 9, 12, 0, 928, 34, 0, }, /* 605 */ - { 49, 7, 12, 0, 0, 49, 0, }, /* 606 */ - { 49, 12, 3, 0, 0, 49, 0, }, /* 607 */ - { 49, 10, 5, 0, 0, 49, 0, }, /* 608 */ - { 49, 26, 12, 0, 0, 49, 0, }, /* 609 */ - { 10, 15, 12, 0, 0, -197, 0, }, /* 610 */ - { 10, 15, 12, 0, 0, -170, 0, }, /* 611 */ - { 10, 26, 12, 0, 0, -145, 0, }, /* 612 */ - { 10, 23, 12, 0, 0, -145, 0, }, /* 613 */ - { 65, 7, 12, 0, 0, 65, 0, }, /* 614 */ - { 65, 21, 12, 0, 0, 65, 0, }, /* 615 */ - { 75, 10, 5, 0, 0, 75, 0, }, /* 616 */ - { 75, 7, 12, 0, 0, 75, 0, }, /* 617 */ - { 75, 12, 3, 0, 0, 75, 0, }, /* 618 */ - { 75, 21, 12, 0, 0, 75, 0, }, /* 619 */ - { 75, 13, 12, 0, 0, 75, 0, }, /* 620 */ - { 15, 12, 3, 0, 0, -16, 0, }, /* 621 */ - { 15, 7, 12, 0, 0, -43, 0, }, /* 622 */ - { 69, 13, 12, 0, 0, 69, 0, }, /* 623 */ - { 69, 7, 12, 0, 0, 69, 0, }, /* 624 */ - { 69, 12, 3, 0, 0, 69, 0, }, /* 625 */ - { 10, 21, 12, 0, 0, -92, 0, }, /* 626 */ - { 69, 21, 12, 0, 0, 69, 0, }, /* 627 */ - { 74, 7, 12, 0, 0, 74, 0, }, /* 628 */ - { 74, 12, 3, 0, 0, 74, 0, }, /* 629 */ - { 74, 10, 5, 0, 0, 74, 0, }, /* 630 */ - { 74, 21, 12, 0, 0, 74, 0, }, /* 631 */ - { 84, 12, 3, 0, 0, 84, 0, }, /* 632 */ - { 84, 10, 5, 0, 0, 84, 0, }, /* 633 */ - { 84, 7, 12, 0, 0, 84, 0, }, /* 634 */ - { 84, 21, 12, 0, 0, 84, 0, }, /* 635 */ - { 10, 6, 12, 0, 0, -22, 0, }, /* 636 */ - { 84, 13, 12, 0, 0, 84, 0, }, /* 637 */ - { 39, 6, 12, 0, 0, 39, 0, }, /* 638 */ - { 68, 7, 12, 0, 0, 68, 0, }, /* 639 */ - { 68, 12, 3, 0, 0, 68, 0, }, /* 640 */ - { 68, 10, 5, 0, 0, 68, 0, }, /* 641 */ - { 68, 13, 12, 0, 0, 68, 0, }, /* 642 */ - { 68, 21, 12, 0, 0, 68, 0, }, /* 643 */ - { 92, 7, 12, 0, 0, 92, 0, }, /* 644 */ - { 92, 12, 3, 0, 0, 92, 0, }, /* 645 */ - { 92, 6, 12, 0, 0, 92, 0, }, /* 646 */ - { 92, 21, 12, 0, 0, 92, 0, }, /* 647 */ - { 87, 7, 12, 0, 0, 87, 0, }, /* 648 */ - { 87, 10, 5, 0, 0, 87, 0, }, /* 649 */ - { 87, 12, 3, 0, 0, 87, 0, }, /* 650 */ - { 87, 21, 12, 0, 0, 87, 0, }, /* 651 */ - { 87, 6, 12, 0, 0, 87, 0, }, /* 652 */ - { 34, 5, 12, 0, -928, 34, 0, }, /* 653 */ - { 9, 5, 12, 0, -38864, 9, 0, }, /* 654 */ - { 87, 13, 12, 0, 0, 87, 0, }, /* 655 */ - { 24, 7, 9, 0, 0, 24, 0, }, /* 656 */ - { 24, 7, 10, 0, 0, 24, 0, }, /* 657 */ - { 0, 4, 2, 0, 0, 0, 0, }, /* 658 */ - { 0, 3, 12, 0, 0, 0, 0, }, /* 659 */ - { 26, 25, 12, 0, 0, 26, 0, }, /* 660 */ - { 1, 24, 12, 0, 0, 1, 0, }, /* 661 */ - { 1, 7, 12, 0, 0, -10, 0, }, /* 662 */ - { 1, 26, 12, 0, 0, -10, 0, }, /* 663 */ - { 10, 6, 3, 0, 0, -58, 0, }, /* 664 */ - { 36, 7, 12, 0, 0, 36, 0, }, /* 665 */ - { 10, 21, 12, 0, 0, -25, 0, }, /* 666 */ - { 10, 15, 12, 0, 0, -76, 0, }, /* 667 */ - { 10, 26, 12, 0, 0, -25, 0, }, /* 668 */ - { 20, 14, 12, 0, 0, 20, 0, }, /* 669 */ - { 20, 15, 12, 0, 0, 20, 0, }, /* 670 */ - { 20, 26, 12, 0, 0, 20, 0, }, /* 671 */ - { 71, 7, 12, 0, 0, 71, 0, }, /* 672 */ - { 67, 7, 12, 0, 0, 67, 0, }, /* 673 */ - { 28, 12, 3, 0, 0, -1, 0, }, /* 674 */ - { 10, 15, 12, 0, 0, -1, 0, }, /* 675 */ - { 42, 7, 12, 0, 0, 42, 0, }, /* 676 */ - { 42, 15, 12, 0, 0, 42, 0, }, /* 677 */ - { 19, 7, 12, 0, 0, 19, 0, }, /* 678 */ - { 19, 14, 12, 0, 0, 19, 0, }, /* 679 */ - { 118, 7, 12, 0, 0, 118, 0, }, /* 680 */ - { 118, 12, 3, 0, 0, 118, 0, }, /* 681 */ - { 60, 7, 12, 0, 0, 60, 0, }, /* 682 */ - { 60, 21, 12, 0, 0, 60, 0, }, /* 683 */ - { 43, 7, 12, 0, 0, 43, 0, }, /* 684 */ - { 43, 21, 12, 0, 0, 43, 0, }, /* 685 */ - { 43, 14, 12, 0, 0, 43, 0, }, /* 686 */ - { 14, 9, 12, 0, 40, 14, 0, }, /* 687 */ - { 14, 5, 12, 0, -40, 14, 0, }, /* 688 */ - { 47, 7, 12, 0, 0, 47, 0, }, /* 689 */ - { 45, 7, 12, 0, 0, 45, 0, }, /* 690 */ - { 45, 13, 12, 0, 0, 45, 0, }, /* 691 */ - { 136, 9, 12, 0, 40, 136, 0, }, /* 692 */ - { 136, 5, 12, 0, -40, 136, 0, }, /* 693 */ - { 106, 7, 12, 0, 0, 106, 0, }, /* 694 */ - { 104, 7, 12, 0, 0, 104, 0, }, /* 695 */ - { 104, 21, 12, 0, 0, 104, 0, }, /* 696 */ - { 110, 7, 12, 0, 0, 110, 0, }, /* 697 */ - { 12, 7, 12, 0, 0, 12, 0, }, /* 698 */ - { 81, 7, 12, 0, 0, 81, 0, }, /* 699 */ - { 81, 21, 12, 0, 0, 81, 0, }, /* 700 */ - { 81, 15, 12, 0, 0, 81, 0, }, /* 701 */ - { 120, 7, 12, 0, 0, 120, 0, }, /* 702 */ - { 120, 26, 12, 0, 0, 120, 0, }, /* 703 */ - { 120, 15, 12, 0, 0, 120, 0, }, /* 704 */ - { 116, 7, 12, 0, 0, 116, 0, }, /* 705 */ - { 116, 15, 12, 0, 0, 116, 0, }, /* 706 */ - { 128, 7, 12, 0, 0, 128, 0, }, /* 707 */ - { 128, 15, 12, 0, 0, 128, 0, }, /* 708 */ - { 66, 7, 12, 0, 0, 66, 0, }, /* 709 */ - { 66, 15, 12, 0, 0, 66, 0, }, /* 710 */ - { 66, 21, 12, 0, 0, 66, 0, }, /* 711 */ - { 72, 7, 12, 0, 0, 72, 0, }, /* 712 */ - { 72, 21, 12, 0, 0, 72, 0, }, /* 713 */ - { 98, 7, 12, 0, 0, 98, 0, }, /* 714 */ - { 97, 7, 12, 0, 0, 97, 0, }, /* 715 */ - { 97, 15, 12, 0, 0, 97, 0, }, /* 716 */ - { 31, 7, 12, 0, 0, 31, 0, }, /* 717 */ - { 31, 12, 3, 0, 0, 31, 0, }, /* 718 */ - { 31, 15, 12, 0, 0, 31, 0, }, /* 719 */ - { 31, 21, 12, 0, 0, 31, 0, }, /* 720 */ - { 88, 7, 12, 0, 0, 88, 0, }, /* 721 */ - { 88, 15, 12, 0, 0, 88, 0, }, /* 722 */ - { 88, 21, 12, 0, 0, 88, 0, }, /* 723 */ - { 117, 7, 12, 0, 0, 117, 0, }, /* 724 */ - { 117, 15, 12, 0, 0, 117, 0, }, /* 725 */ - { 112, 7, 12, 0, 0, 112, 0, }, /* 726 */ - { 112, 26, 12, 0, 0, 112, 0, }, /* 727 */ - { 112, 12, 3, 0, 0, 112, 0, }, /* 728 */ - { 112, 15, 12, 0, 0, 112, 0, }, /* 729 */ - { 112, 21, 12, 0, 0, 112, 0, }, /* 730 */ - { 78, 7, 12, 0, 0, 78, 0, }, /* 731 */ - { 78, 21, 12, 0, 0, 78, 0, }, /* 732 */ - { 83, 7, 12, 0, 0, 83, 0, }, /* 733 */ - { 83, 15, 12, 0, 0, 83, 0, }, /* 734 */ - { 82, 7, 12, 0, 0, 82, 0, }, /* 735 */ - { 82, 15, 12, 0, 0, 82, 0, }, /* 736 */ - { 121, 7, 12, 0, 0, 121, 0, }, /* 737 */ - { 121, 21, 12, 0, 0, 121, 0, }, /* 738 */ - { 121, 15, 12, 0, 0, 121, 0, }, /* 739 */ - { 89, 7, 12, 0, 0, 89, 0, }, /* 740 */ - { 130, 9, 12, 0, 64, 130, 0, }, /* 741 */ - { 130, 5, 12, 0, -64, 130, 0, }, /* 742 */ - { 130, 15, 12, 0, 0, 130, 0, }, /* 743 */ - { 144, 7, 12, 0, 0, 144, 0, }, /* 744 */ - { 144, 12, 3, 0, 0, 144, 0, }, /* 745 */ - { 144, 13, 12, 0, 0, 144, 0, }, /* 746 */ - { 1, 15, 12, 0, 0, 1, 0, }, /* 747 */ - { 147, 7, 12, 0, 0, 147, 0, }, /* 748 */ - { 147, 15, 12, 0, 0, 147, 0, }, /* 749 */ - { 148, 7, 12, 0, 0, 148, 0, }, /* 750 */ - { 148, 12, 3, 0, 0, 148, 0, }, /* 751 */ - { 148, 15, 12, 0, 0, 148, 0, }, /* 752 */ - { 148, 21, 12, 0, 0, 148, 0, }, /* 753 */ - { 94, 10, 5, 0, 0, 94, 0, }, /* 754 */ - { 94, 12, 3, 0, 0, 94, 0, }, /* 755 */ - { 94, 7, 12, 0, 0, 94, 0, }, /* 756 */ - { 94, 21, 12, 0, 0, 94, 0, }, /* 757 */ - { 94, 15, 12, 0, 0, 94, 0, }, /* 758 */ - { 94, 13, 12, 0, 0, 94, 0, }, /* 759 */ - { 85, 12, 3, 0, 0, 85, 0, }, /* 760 */ - { 85, 10, 5, 0, 0, 85, 0, }, /* 761 */ - { 85, 7, 12, 0, 0, 85, 0, }, /* 762 */ - { 85, 21, 12, 0, 0, 85, 0, }, /* 763 */ - { 85, 1, 4, 0, 0, 85, 0, }, /* 764 */ - { 101, 7, 12, 0, 0, 101, 0, }, /* 765 */ - { 101, 13, 12, 0, 0, 101, 0, }, /* 766 */ - { 96, 12, 3, 0, 0, 96, 0, }, /* 767 */ - { 96, 7, 12, 0, 0, 96, 0, }, /* 768 */ - { 96, 10, 5, 0, 0, 96, 0, }, /* 769 */ - { 96, 13, 12, 0, 0, 96, 0, }, /* 770 */ - { 96, 21, 12, 0, 0, 96, 0, }, /* 771 */ - { 111, 7, 12, 0, 0, 111, 0, }, /* 772 */ - { 111, 12, 3, 0, 0, 111, 0, }, /* 773 */ - { 111, 21, 12, 0, 0, 111, 0, }, /* 774 */ - { 100, 12, 3, 0, 0, 100, 0, }, /* 775 */ - { 100, 10, 5, 0, 0, 100, 0, }, /* 776 */ - { 100, 7, 12, 0, 0, 100, 0, }, /* 777 */ - { 100, 7, 4, 0, 0, 100, 0, }, /* 778 */ - { 100, 21, 12, 0, 0, 100, 0, }, /* 779 */ - { 100, 13, 12, 0, 0, 100, 0, }, /* 780 */ - { 48, 15, 12, 0, 0, 48, 0, }, /* 781 */ - { 108, 7, 12, 0, 0, 108, 0, }, /* 782 */ - { 108, 10, 5, 0, 0, 108, 0, }, /* 783 */ - { 108, 12, 3, 0, 0, 108, 0, }, /* 784 */ - { 108, 21, 12, 0, 0, 108, 0, }, /* 785 */ - { 129, 7, 12, 0, 0, 129, 0, }, /* 786 */ - { 129, 21, 12, 0, 0, 129, 0, }, /* 787 */ - { 109, 7, 12, 0, 0, 109, 0, }, /* 788 */ - { 109, 12, 3, 0, 0, 109, 0, }, /* 789 */ - { 109, 10, 5, 0, 0, 109, 0, }, /* 790 */ - { 109, 13, 12, 0, 0, 109, 0, }, /* 791 */ - { 107, 12, 3, 0, 0, 107, 0, }, /* 792 */ - { 107, 12, 3, 0, 0, -49, 0, }, /* 793 */ - { 107, 10, 5, 0, 0, 107, 0, }, /* 794 */ - { 107, 10, 5, 0, 0, -49, 0, }, /* 795 */ - { 107, 7, 12, 0, 0, 107, 0, }, /* 796 */ - { 28, 12, 3, 0, 0, -49, 0, }, /* 797 */ - { 107, 10, 3, 0, 0, 107, 0, }, /* 798 */ - { 135, 7, 12, 0, 0, 135, 0, }, /* 799 */ - { 135, 10, 5, 0, 0, 135, 0, }, /* 800 */ - { 135, 12, 3, 0, 0, 135, 0, }, /* 801 */ - { 135, 21, 12, 0, 0, 135, 0, }, /* 802 */ - { 135, 13, 12, 0, 0, 135, 0, }, /* 803 */ - { 124, 7, 12, 0, 0, 124, 0, }, /* 804 */ - { 124, 10, 3, 0, 0, 124, 0, }, /* 805 */ - { 124, 10, 5, 0, 0, 124, 0, }, /* 806 */ - { 124, 12, 3, 0, 0, 124, 0, }, /* 807 */ - { 124, 21, 12, 0, 0, 124, 0, }, /* 808 */ - { 124, 13, 12, 0, 0, 124, 0, }, /* 809 */ - { 123, 7, 12, 0, 0, 123, 0, }, /* 810 */ - { 123, 10, 3, 0, 0, 123, 0, }, /* 811 */ - { 123, 10, 5, 0, 0, 123, 0, }, /* 812 */ - { 123, 12, 3, 0, 0, 123, 0, }, /* 813 */ - { 123, 21, 12, 0, 0, 123, 0, }, /* 814 */ - { 114, 7, 12, 0, 0, 114, 0, }, /* 815 */ - { 114, 10, 5, 0, 0, 114, 0, }, /* 816 */ - { 114, 12, 3, 0, 0, 114, 0, }, /* 817 */ - { 114, 21, 12, 0, 0, 114, 0, }, /* 818 */ - { 114, 13, 12, 0, 0, 114, 0, }, /* 819 */ - { 102, 7, 12, 0, 0, 102, 0, }, /* 820 */ - { 102, 12, 3, 0, 0, 102, 0, }, /* 821 */ - { 102, 10, 5, 0, 0, 102, 0, }, /* 822 */ - { 102, 13, 12, 0, 0, 102, 0, }, /* 823 */ - { 126, 7, 12, 0, 0, 126, 0, }, /* 824 */ - { 126, 12, 3, 0, 0, 126, 0, }, /* 825 */ - { 126, 10, 5, 0, 0, 126, 0, }, /* 826 */ - { 126, 13, 12, 0, 0, 126, 0, }, /* 827 */ - { 126, 15, 12, 0, 0, 126, 0, }, /* 828 */ - { 126, 21, 12, 0, 0, 126, 0, }, /* 829 */ - { 126, 26, 12, 0, 0, 126, 0, }, /* 830 */ - { 142, 7, 12, 0, 0, 142, 0, }, /* 831 */ - { 142, 10, 5, 0, 0, 142, 0, }, /* 832 */ - { 142, 12, 3, 0, 0, 142, 0, }, /* 833 */ - { 142, 21, 12, 0, 0, 142, 0, }, /* 834 */ - { 125, 9, 12, 0, 32, 125, 0, }, /* 835 */ - { 125, 5, 12, 0, -32, 125, 0, }, /* 836 */ - { 125, 13, 12, 0, 0, 125, 0, }, /* 837 */ - { 125, 15, 12, 0, 0, 125, 0, }, /* 838 */ - { 125, 7, 12, 0, 0, 125, 0, }, /* 839 */ - { 141, 7, 12, 0, 0, 141, 0, }, /* 840 */ - { 141, 12, 3, 0, 0, 141, 0, }, /* 841 */ - { 141, 10, 5, 0, 0, 141, 0, }, /* 842 */ - { 141, 7, 4, 0, 0, 141, 0, }, /* 843 */ - { 141, 21, 12, 0, 0, 141, 0, }, /* 844 */ - { 140, 7, 12, 0, 0, 140, 0, }, /* 845 */ - { 140, 12, 3, 0, 0, 140, 0, }, /* 846 */ - { 140, 10, 5, 0, 0, 140, 0, }, /* 847 */ - { 140, 7, 4, 0, 0, 140, 0, }, /* 848 */ - { 140, 21, 12, 0, 0, 140, 0, }, /* 849 */ - { 122, 7, 12, 0, 0, 122, 0, }, /* 850 */ - { 133, 7, 12, 0, 0, 133, 0, }, /* 851 */ - { 133, 10, 5, 0, 0, 133, 0, }, /* 852 */ - { 133, 12, 3, 0, 0, 133, 0, }, /* 853 */ - { 133, 21, 12, 0, 0, 133, 0, }, /* 854 */ - { 133, 13, 12, 0, 0, 133, 0, }, /* 855 */ - { 133, 15, 12, 0, 0, 133, 0, }, /* 856 */ - { 134, 21, 12, 0, 0, 134, 0, }, /* 857 */ - { 134, 7, 12, 0, 0, 134, 0, }, /* 858 */ - { 134, 12, 3, 0, 0, 134, 0, }, /* 859 */ - { 134, 10, 5, 0, 0, 134, 0, }, /* 860 */ - { 138, 7, 12, 0, 0, 138, 0, }, /* 861 */ - { 138, 12, 3, 0, 0, 138, 0, }, /* 862 */ - { 138, 7, 4, 0, 0, 138, 0, }, /* 863 */ - { 138, 13, 12, 0, 0, 138, 0, }, /* 864 */ - { 143, 7, 12, 0, 0, 143, 0, }, /* 865 */ - { 143, 10, 5, 0, 0, 143, 0, }, /* 866 */ - { 143, 12, 3, 0, 0, 143, 0, }, /* 867 */ - { 143, 13, 12, 0, 0, 143, 0, }, /* 868 */ - { 145, 7, 12, 0, 0, 145, 0, }, /* 869 */ - { 145, 12, 3, 0, 0, 145, 0, }, /* 870 */ - { 145, 10, 5, 0, 0, 145, 0, }, /* 871 */ - { 145, 21, 12, 0, 0, 145, 0, }, /* 872 */ - { 63, 7, 12, 0, 0, 63, 0, }, /* 873 */ - { 63, 14, 12, 0, 0, 63, 0, }, /* 874 */ - { 63, 21, 12, 0, 0, 63, 0, }, /* 875 */ - { 80, 7, 12, 0, 0, 80, 0, }, /* 876 */ - { 127, 7, 12, 0, 0, 127, 0, }, /* 877 */ - { 115, 7, 12, 0, 0, 115, 0, }, /* 878 */ - { 115, 13, 12, 0, 0, 115, 0, }, /* 879 */ - { 115, 21, 12, 0, 0, 115, 0, }, /* 880 */ - { 103, 7, 12, 0, 0, 103, 0, }, /* 881 */ - { 103, 12, 3, 0, 0, 103, 0, }, /* 882 */ - { 103, 21, 12, 0, 0, 103, 0, }, /* 883 */ - { 119, 7, 12, 0, 0, 119, 0, }, /* 884 */ - { 119, 12, 3, 0, 0, 119, 0, }, /* 885 */ - { 119, 21, 12, 0, 0, 119, 0, }, /* 886 */ - { 119, 26, 12, 0, 0, 119, 0, }, /* 887 */ - { 119, 6, 12, 0, 0, 119, 0, }, /* 888 */ - { 119, 13, 12, 0, 0, 119, 0, }, /* 889 */ - { 119, 15, 12, 0, 0, 119, 0, }, /* 890 */ - { 146, 9, 12, 0, 32, 146, 0, }, /* 891 */ - { 146, 5, 12, 0, -32, 146, 0, }, /* 892 */ - { 146, 15, 12, 0, 0, 146, 0, }, /* 893 */ - { 146, 21, 12, 0, 0, 146, 0, }, /* 894 */ - { 99, 7, 12, 0, 0, 99, 0, }, /* 895 */ - { 99, 10, 5, 0, 0, 99, 0, }, /* 896 */ - { 99, 12, 3, 0, 0, 99, 0, }, /* 897 */ - { 99, 6, 12, 0, 0, 99, 0, }, /* 898 */ - { 137, 6, 12, 0, 0, 137, 0, }, /* 899 */ - { 139, 6, 12, 0, 0, 139, 0, }, /* 900 */ - { 137, 7, 12, 0, 0, 137, 0, }, /* 901 */ - { 139, 7, 12, 0, 0, 139, 0, }, /* 902 */ - { 105, 7, 12, 0, 0, 105, 0, }, /* 903 */ - { 105, 26, 12, 0, 0, 105, 0, }, /* 904 */ - { 105, 12, 3, 0, 0, 105, 0, }, /* 905 */ - { 105, 21, 12, 0, 0, 105, 0, }, /* 906 */ - { 10, 1, 2, 0, 0, 105, 0, }, /* 907 */ - { 10, 10, 3, 0, 0, 10, 0, }, /* 908 */ - { 10, 10, 5, 0, 0, 10, 0, }, /* 909 */ - { 20, 12, 3, 0, 0, 20, 0, }, /* 910 */ - { 131, 26, 12, 0, 0, 131, 0, }, /* 911 */ - { 131, 12, 3, 0, 0, 131, 0, }, /* 912 */ - { 131, 21, 12, 0, 0, 131, 0, }, /* 913 */ - { 18, 12, 3, 0, 0, 18, 0, }, /* 914 */ - { 113, 7, 12, 0, 0, 113, 0, }, /* 915 */ - { 113, 15, 12, 0, 0, 113, 0, }, /* 916 */ - { 113, 12, 3, 0, 0, 113, 0, }, /* 917 */ - { 132, 9, 12, 0, 34, 132, 0, }, /* 918 */ - { 132, 5, 12, 0, -34, 132, 0, }, /* 919 */ - { 132, 12, 3, 0, 0, 132, 0, }, /* 920 */ - { 132, 13, 12, 0, 0, 132, 0, }, /* 921 */ - { 132, 21, 12, 0, 0, 132, 0, }, /* 922 */ - { 0, 2, 14, 0, 0, 0, 0, }, /* 923 */ - { 10, 26, 11, 0, 0, 10, 0, }, /* 924 */ - { 27, 26, 12, 0, 0, 27, 0, }, /* 925 */ - { 10, 24, 3, 0, 0, 10, 0, }, /* 926 */ - { 10, 1, 3, 0, 0, 10, 0, }, /* 927 */ + { 34, 5, 12, 0, 42307, 34, 0, }, /* 102 */ + { 34, 5, 12, 0, 42282, 34, 0, }, /* 103 */ + { 34, 5, 12, 0, -69, 34, 0, }, /* 104 */ + { 34, 5, 12, 0, -217, 34, 0, }, /* 105 */ + { 34, 5, 12, 0, -71, 34, 0, }, /* 106 */ + { 34, 5, 12, 0, -219, 34, 0, }, /* 107 */ + { 34, 5, 12, 0, 42261, 34, 0, }, /* 108 */ + { 34, 5, 12, 0, 42258, 34, 0, }, /* 109 */ + { 34, 6, 12, 0, 0, 34, 0, }, /* 110 */ + { 10, 6, 12, 0, 0, 10, 0, }, /* 111 */ + { 4, 24, 12, 0, 0, 4, 0, }, /* 112 */ + { 28, 12, 3, 0, 0, 28, 0, }, /* 113 */ + { 28, 12, 3, 0, 0, 20, 0, }, /* 114 */ + { 28, 12, 3, 21, 116, 20, 0, }, /* 115 */ + { 28, 12, 3, 0, 0, 34, 0, }, /* 116 */ + { 20, 9, 12, 0, 1, 20, 0, }, /* 117 */ + { 20, 5, 12, 0, -1, 20, 0, }, /* 118 */ + { 20, 24, 12, 0, 0, 20, 0, }, /* 119 */ + { 0, 2, 12, 0, 0, 0, 0, }, /* 120 */ + { 20, 6, 12, 0, 0, 20, 0, }, /* 121 */ + { 20, 5, 12, 0, 130, 20, 0, }, /* 122 */ + { 20, 9, 12, 0, 116, 20, 0, }, /* 123 */ + { 20, 9, 12, 0, 38, 20, 0, }, /* 124 */ + { 20, 9, 12, 0, 37, 20, 0, }, /* 125 */ + { 20, 9, 12, 0, 64, 20, 0, }, /* 126 */ + { 20, 9, 12, 0, 63, 20, 0, }, /* 127 */ + { 20, 5, 12, 0, 0, 20, 0, }, /* 128 */ + { 20, 9, 12, 0, 32, 20, 0, }, /* 129 */ + { 20, 9, 12, 34, 32, 20, 0, }, /* 130 */ + { 20, 9, 12, 59, 32, 20, 0, }, /* 131 */ + { 20, 9, 12, 38, 32, 20, 0, }, /* 132 */ + { 20, 9, 12, 21, 32, 20, 0, }, /* 133 */ + { 20, 9, 12, 51, 32, 20, 0, }, /* 134 */ + { 20, 9, 12, 26, 32, 20, 0, }, /* 135 */ + { 20, 9, 12, 47, 32, 20, 0, }, /* 136 */ + { 20, 9, 12, 55, 32, 20, 0, }, /* 137 */ + { 20, 9, 12, 30, 32, 20, 0, }, /* 138 */ + { 20, 9, 12, 43, 32, 20, 0, }, /* 139 */ + { 20, 9, 12, 96, 32, 20, 0, }, /* 140 */ + { 20, 5, 12, 0, -38, 20, 0, }, /* 141 */ + { 20, 5, 12, 0, -37, 20, 0, }, /* 142 */ + { 20, 5, 12, 0, -32, 20, 0, }, /* 143 */ + { 20, 5, 12, 34, -32, 20, 0, }, /* 144 */ + { 20, 5, 12, 59, -32, 20, 0, }, /* 145 */ + { 20, 5, 12, 38, -32, 20, 0, }, /* 146 */ + { 20, 5, 12, 21, -116, 20, 0, }, /* 147 */ + { 20, 5, 12, 51, -32, 20, 0, }, /* 148 */ + { 20, 5, 12, 26, -775, 20, 0, }, /* 149 */ + { 20, 5, 12, 47, -32, 20, 0, }, /* 150 */ + { 20, 5, 12, 55, -32, 20, 0, }, /* 151 */ + { 20, 5, 12, 30, 1, 20, 0, }, /* 152 */ + { 20, 5, 12, 30, -32, 20, 0, }, /* 153 */ + { 20, 5, 12, 43, -32, 20, 0, }, /* 154 */ + { 20, 5, 12, 96, -32, 20, 0, }, /* 155 */ + { 20, 5, 12, 0, -64, 20, 0, }, /* 156 */ + { 20, 5, 12, 0, -63, 20, 0, }, /* 157 */ + { 20, 9, 12, 0, 8, 20, 0, }, /* 158 */ + { 20, 5, 12, 34, -30, 20, 0, }, /* 159 */ + { 20, 5, 12, 38, -25, 20, 0, }, /* 160 */ + { 20, 9, 12, 0, 0, 20, 0, }, /* 161 */ + { 20, 5, 12, 43, -15, 20, 0, }, /* 162 */ + { 20, 5, 12, 47, -22, 20, 0, }, /* 163 */ + { 20, 5, 12, 0, -8, 20, 0, }, /* 164 */ + { 11, 9, 12, 0, 1, 11, 0, }, /* 165 */ + { 11, 5, 12, 0, -1, 11, 0, }, /* 166 */ + { 20, 5, 12, 51, -54, 20, 0, }, /* 167 */ + { 20, 5, 12, 55, -48, 20, 0, }, /* 168 */ + { 20, 5, 12, 0, 7, 20, 0, }, /* 169 */ + { 20, 5, 12, 0, -116, 20, 0, }, /* 170 */ + { 20, 9, 12, 38, -60, 20, 0, }, /* 171 */ + { 20, 5, 12, 59, -64, 20, 0, }, /* 172 */ + { 20, 25, 12, 0, 0, 20, 0, }, /* 173 */ + { 20, 9, 12, 0, -7, 20, 0, }, /* 174 */ + { 20, 9, 12, 0, -130, 20, 0, }, /* 175 */ + { 13, 9, 12, 0, 80, 13, 0, }, /* 176 */ + { 13, 9, 12, 0, 32, 13, 0, }, /* 177 */ + { 13, 9, 12, 63, 32, 13, 0, }, /* 178 */ + { 13, 9, 12, 67, 32, 13, 0, }, /* 179 */ + { 13, 9, 12, 71, 32, 13, 0, }, /* 180 */ + { 13, 9, 12, 75, 32, 13, 0, }, /* 181 */ + { 13, 9, 12, 79, 32, 13, 0, }, /* 182 */ + { 13, 9, 12, 84, 32, 13, 0, }, /* 183 */ + { 13, 5, 12, 0, -32, 13, 0, }, /* 184 */ + { 13, 5, 12, 63, -32, 13, 0, }, /* 185 */ + { 13, 5, 12, 67, -32, 13, 0, }, /* 186 */ + { 13, 5, 12, 71, -32, 13, 0, }, /* 187 */ + { 13, 5, 12, 75, -32, 13, 0, }, /* 188 */ + { 13, 5, 12, 79, -32, 13, 0, }, /* 189 */ + { 13, 5, 12, 84, -32, 13, 0, }, /* 190 */ + { 13, 5, 12, 0, -80, 13, 0, }, /* 191 */ + { 13, 9, 12, 0, 1, 13, 0, }, /* 192 */ + { 13, 5, 12, 0, -1, 13, 0, }, /* 193 */ + { 13, 9, 12, 88, 1, 13, 0, }, /* 194 */ + { 13, 5, 12, 88, -1, 13, 0, }, /* 195 */ + { 13, 26, 12, 0, 0, 13, 0, }, /* 196 */ + { 13, 12, 3, 0, 0, -34, 0, }, /* 197 */ + { 13, 12, 3, 0, 0, -28, 0, }, /* 198 */ + { 28, 12, 3, 0, 0, -31, 0, }, /* 199 */ + { 13, 11, 3, 0, 0, 13, 0, }, /* 200 */ + { 13, 9, 12, 0, 15, 13, 0, }, /* 201 */ + { 13, 5, 12, 0, -15, 13, 0, }, /* 202 */ + { 2, 9, 12, 0, 48, 2, 0, }, /* 203 */ + { 2, 6, 12, 0, 0, 2, 0, }, /* 204 */ + { 2, 21, 12, 0, 0, 2, 0, }, /* 205 */ + { 2, 5, 12, 0, 0, 2, 0, }, /* 206 */ + { 2, 5, 12, 0, -48, 2, 0, }, /* 207 */ + { 10, 21, 12, 0, 0, -13, 0, }, /* 208 */ + { 2, 17, 12, 0, 0, 2, 0, }, /* 209 */ + { 2, 26, 12, 0, 0, 2, 0, }, /* 210 */ + { 2, 23, 12, 0, 0, 2, 0, }, /* 211 */ + { 26, 12, 3, 0, 0, 26, 0, }, /* 212 */ + { 26, 17, 12, 0, 0, 26, 0, }, /* 213 */ + { 26, 21, 12, 0, 0, 26, 0, }, /* 214 */ + { 26, 7, 12, 0, 0, 26, 0, }, /* 215 */ + { 1, 1, 4, 0, 0, 1, 0, }, /* 216 */ + { 10, 1, 4, 0, 0, 10, 0, }, /* 217 */ + { 1, 25, 12, 0, 0, 1, 0, }, /* 218 */ + { 1, 21, 12, 0, 0, 1, 0, }, /* 219 */ + { 1, 23, 12, 0, 0, 1, 0, }, /* 220 */ + { 10, 21, 12, 0, 0, -105, 0, }, /* 221 */ + { 1, 26, 12, 0, 0, 1, 0, }, /* 222 */ + { 1, 12, 3, 0, 0, 1, 0, }, /* 223 */ + { 1, 1, 2, 0, 0, -73, 0, }, /* 224 */ + { 1, 7, 12, 0, 0, 1, 0, }, /* 225 */ + { 10, 6, 12, 0, 0, -145, 0, }, /* 226 */ + { 28, 12, 3, 0, 0, -7, 0, }, /* 227 */ + { 1, 13, 12, 0, 0, -10, 0, }, /* 228 */ + { 1, 21, 12, 0, 0, -4, 0, }, /* 229 */ + { 1, 6, 12, 0, 0, 1, 0, }, /* 230 */ + { 1, 13, 12, 0, 0, 1, 0, }, /* 231 */ + { 50, 21, 12, 0, 0, 50, 0, }, /* 232 */ + { 50, 1, 4, 0, 0, 50, 0, }, /* 233 */ + { 50, 7, 12, 0, 0, 50, 0, }, /* 234 */ + { 50, 12, 3, 0, 0, 50, 0, }, /* 235 */ + { 56, 7, 12, 0, 0, 56, 0, }, /* 236 */ + { 56, 12, 3, 0, 0, 56, 0, }, /* 237 */ + { 64, 13, 12, 0, 0, 64, 0, }, /* 238 */ + { 64, 7, 12, 0, 0, 64, 0, }, /* 239 */ + { 64, 12, 3, 0, 0, 64, 0, }, /* 240 */ + { 64, 6, 12, 0, 0, 64, 0, }, /* 241 */ + { 64, 26, 12, 0, 0, 64, 0, }, /* 242 */ + { 64, 21, 12, 0, 0, 64, 0, }, /* 243 */ + { 64, 23, 12, 0, 0, 64, 0, }, /* 244 */ + { 90, 7, 12, 0, 0, 90, 0, }, /* 245 */ + { 90, 12, 3, 0, 0, 90, 0, }, /* 246 */ + { 90, 6, 12, 0, 0, 90, 0, }, /* 247 */ + { 90, 21, 12, 0, 0, 90, 0, }, /* 248 */ + { 95, 7, 12, 0, 0, 95, 0, }, /* 249 */ + { 95, 12, 3, 0, 0, 95, 0, }, /* 250 */ + { 95, 21, 12, 0, 0, 95, 0, }, /* 251 */ + { 15, 12, 3, 0, 0, 15, 0, }, /* 252 */ + { 15, 10, 5, 0, 0, 15, 0, }, /* 253 */ + { 15, 7, 12, 0, 0, 15, 0, }, /* 254 */ + { 28, 12, 3, 0, 0, -188, 0, }, /* 255 */ + { 28, 12, 3, 0, 0, -175, 0, }, /* 256 */ + { 10, 21, 12, 0, 0, -231, 0, }, /* 257 */ + { 10, 21, 12, 0, 0, -252, 0, }, /* 258 */ + { 15, 13, 12, 0, 0, -120, 0, }, /* 259 */ + { 15, 21, 12, 0, 0, 15, 0, }, /* 260 */ + { 15, 6, 12, 0, 0, 15, 0, }, /* 261 */ + { 3, 7, 12, 0, 0, 3, 0, }, /* 262 */ + { 3, 12, 3, 0, 0, 3, 0, }, /* 263 */ + { 3, 10, 5, 0, 0, 3, 0, }, /* 264 */ + { 3, 10, 3, 0, 0, 3, 0, }, /* 265 */ + { 3, 13, 12, 0, 0, -77, 0, }, /* 266 */ + { 3, 23, 12, 0, 0, 3, 0, }, /* 267 */ + { 3, 15, 12, 0, 0, 3, 0, }, /* 268 */ + { 3, 26, 12, 0, 0, 3, 0, }, /* 269 */ + { 3, 21, 12, 0, 0, 3, 0, }, /* 270 */ + { 22, 12, 3, 0, 0, 22, 0, }, /* 271 */ + { 22, 10, 5, 0, 0, 22, 0, }, /* 272 */ + { 22, 7, 12, 0, 0, 22, 0, }, /* 273 */ + { 22, 13, 12, 0, 0, -58, 0, }, /* 274 */ + { 22, 21, 12, 0, 0, 22, 0, }, /* 275 */ + { 21, 12, 3, 0, 0, 21, 0, }, /* 276 */ + { 21, 10, 5, 0, 0, 21, 0, }, /* 277 */ + { 21, 7, 12, 0, 0, 21, 0, }, /* 278 */ + { 21, 13, 12, 0, 0, -55, 0, }, /* 279 */ + { 21, 21, 12, 0, 0, 21, 0, }, /* 280 */ + { 21, 23, 12, 0, 0, 21, 0, }, /* 281 */ + { 44, 12, 3, 0, 0, 44, 0, }, /* 282 */ + { 44, 10, 5, 0, 0, 44, 0, }, /* 283 */ + { 44, 7, 12, 0, 0, 44, 0, }, /* 284 */ + { 44, 10, 3, 0, 0, 44, 0, }, /* 285 */ + { 44, 13, 12, 0, 0, 44, 0, }, /* 286 */ + { 44, 26, 12, 0, 0, 44, 0, }, /* 287 */ + { 44, 15, 12, 0, 0, 44, 0, }, /* 288 */ + { 54, 12, 3, 0, 0, 54, 0, }, /* 289 */ + { 54, 7, 12, 0, 0, 54, 0, }, /* 290 */ + { 54, 10, 3, 0, 0, 54, 0, }, /* 291 */ + { 54, 10, 5, 0, 0, 54, 0, }, /* 292 */ + { 54, 13, 12, 0, 0, -52, 0, }, /* 293 */ + { 54, 15, 12, 0, 0, -52, 0, }, /* 294 */ + { 54, 26, 12, 0, 0, -52, 0, }, /* 295 */ + { 54, 26, 12, 0, 0, 54, 0, }, /* 296 */ + { 54, 23, 12, 0, 0, 54, 0, }, /* 297 */ + { 55, 12, 3, 0, 0, 55, 0, }, /* 298 */ + { 55, 10, 5, 0, 0, 55, 0, }, /* 299 */ + { 55, 7, 12, 0, 0, 55, 0, }, /* 300 */ + { 55, 13, 12, 0, 0, 55, 0, }, /* 301 */ + { 55, 21, 12, 0, 0, 55, 0, }, /* 302 */ + { 55, 15, 12, 0, 0, 55, 0, }, /* 303 */ + { 55, 26, 12, 0, 0, 55, 0, }, /* 304 */ + { 29, 7, 12, 0, 0, 29, 0, }, /* 305 */ + { 29, 12, 3, 0, 0, 29, 0, }, /* 306 */ + { 29, 10, 5, 0, 0, 29, 0, }, /* 307 */ + { 29, 21, 12, 0, 0, 29, 0, }, /* 308 */ + { 29, 10, 3, 0, 0, 29, 0, }, /* 309 */ + { 29, 13, 12, 0, 0, -64, 0, }, /* 310 */ + { 37, 12, 3, 0, 0, 37, 0, }, /* 311 */ + { 37, 10, 5, 0, 0, 37, 0, }, /* 312 */ + { 37, 7, 12, 0, 0, 37, 0, }, /* 313 */ + { 37, 10, 3, 0, 0, 37, 0, }, /* 314 */ + { 37, 7, 4, 0, 0, 37, 0, }, /* 315 */ + { 37, 26, 12, 0, 0, 37, 0, }, /* 316 */ + { 37, 15, 12, 0, 0, 37, 0, }, /* 317 */ + { 37, 13, 12, 0, 0, 37, 0, }, /* 318 */ + { 48, 10, 5, 0, 0, 48, 0, }, /* 319 */ + { 48, 7, 12, 0, 0, 48, 0, }, /* 320 */ + { 48, 12, 3, 0, 0, 48, 0, }, /* 321 */ + { 48, 10, 3, 0, 0, 48, 0, }, /* 322 */ + { 48, 13, 12, 0, 0, 48, 0, }, /* 323 */ + { 48, 21, 12, 0, 0, 48, 0, }, /* 324 */ + { 57, 7, 12, 0, 0, 57, 0, }, /* 325 */ + { 57, 12, 3, 0, 0, 57, 0, }, /* 326 */ + { 57, 7, 5, 0, 0, 57, 0, }, /* 327 */ + { 57, 6, 12, 0, 0, 57, 0, }, /* 328 */ + { 57, 21, 12, 0, 0, 57, 0, }, /* 329 */ + { 57, 13, 12, 0, 0, 57, 0, }, /* 330 */ + { 33, 7, 12, 0, 0, 33, 0, }, /* 331 */ + { 33, 12, 3, 0, 0, 33, 0, }, /* 332 */ + { 33, 7, 5, 0, 0, 33, 0, }, /* 333 */ + { 33, 6, 12, 0, 0, 33, 0, }, /* 334 */ + { 33, 13, 12, 0, 0, 33, 0, }, /* 335 */ + { 58, 7, 12, 0, 0, 58, 0, }, /* 336 */ + { 58, 26, 12, 0, 0, 58, 0, }, /* 337 */ + { 58, 21, 12, 0, 0, 58, 0, }, /* 338 */ + { 58, 12, 3, 0, 0, 58, 0, }, /* 339 */ + { 58, 13, 12, 0, 0, 58, 0, }, /* 340 */ + { 58, 15, 12, 0, 0, 58, 0, }, /* 341 */ + { 58, 22, 12, 0, 0, 58, 0, }, /* 342 */ + { 58, 18, 12, 0, 0, 58, 0, }, /* 343 */ + { 58, 10, 5, 0, 0, 58, 0, }, /* 344 */ + { 39, 7, 12, 0, 0, 39, 0, }, /* 345 */ + { 39, 10, 12, 0, 0, 39, 0, }, /* 346 */ + { 39, 12, 3, 0, 0, 39, 0, }, /* 347 */ + { 39, 10, 5, 0, 0, 39, 0, }, /* 348 */ + { 39, 13, 12, 0, 0, -81, 0, }, /* 349 */ + { 39, 21, 12, 0, 0, 39, 0, }, /* 350 */ + { 39, 13, 12, 0, 0, 39, 0, }, /* 351 */ + { 39, 26, 12, 0, 0, 39, 0, }, /* 352 */ + { 17, 9, 12, 0, 7264, 17, 0, }, /* 353 */ + { 17, 5, 12, 0, 3008, 17, 0, }, /* 354 */ + { 10, 21, 12, 0, 0, -49, 0, }, /* 355 */ + { 17, 6, 12, 0, 0, 17, 0, }, /* 356 */ + { 24, 7, 6, 0, 0, 24, 0, }, /* 357 */ + { 24, 7, 7, 0, 0, 24, 0, }, /* 358 */ + { 24, 7, 8, 0, 0, 24, 0, }, /* 359 */ + { 16, 7, 12, 0, 0, 16, 0, }, /* 360 */ + { 16, 12, 3, 0, 0, 16, 0, }, /* 361 */ + { 16, 21, 12, 0, 0, 16, 0, }, /* 362 */ + { 16, 15, 12, 0, 0, 16, 0, }, /* 363 */ + { 16, 26, 12, 0, 0, 16, 0, }, /* 364 */ + { 9, 9, 12, 0, 38864, 9, 0, }, /* 365 */ + { 9, 9, 12, 0, 8, 9, 0, }, /* 366 */ + { 9, 5, 12, 0, -8, 9, 0, }, /* 367 */ + { 8, 17, 12, 0, 0, 8, 0, }, /* 368 */ + { 8, 7, 12, 0, 0, 8, 0, }, /* 369 */ + { 8, 26, 12, 0, 0, 8, 0, }, /* 370 */ + { 8, 21, 12, 0, 0, 8, 0, }, /* 371 */ + { 41, 29, 12, 0, 0, 41, 0, }, /* 372 */ + { 41, 7, 12, 0, 0, 41, 0, }, /* 373 */ + { 41, 22, 12, 0, 0, 41, 0, }, /* 374 */ + { 41, 18, 12, 0, 0, 41, 0, }, /* 375 */ + { 46, 7, 12, 0, 0, 46, 0, }, /* 376 */ + { 46, 14, 12, 0, 0, 46, 0, }, /* 377 */ + { 51, 7, 12, 0, 0, 51, 0, }, /* 378 */ + { 51, 12, 3, 0, 0, 51, 0, }, /* 379 */ + { 25, 7, 12, 0, 0, 25, 0, }, /* 380 */ + { 25, 12, 3, 0, 0, 25, 0, }, /* 381 */ + { 10, 21, 12, 0, 0, -115, 0, }, /* 382 */ + { 7, 7, 12, 0, 0, 7, 0, }, /* 383 */ + { 7, 12, 3, 0, 0, 7, 0, }, /* 384 */ + { 52, 7, 12, 0, 0, 52, 0, }, /* 385 */ + { 52, 12, 3, 0, 0, 52, 0, }, /* 386 */ + { 32, 7, 12, 0, 0, 32, 0, }, /* 387 */ + { 32, 12, 3, 0, 0, 32, 0, }, /* 388 */ + { 32, 10, 5, 0, 0, 32, 0, }, /* 389 */ + { 32, 21, 12, 0, 0, 32, 0, }, /* 390 */ + { 32, 6, 12, 0, 0, 32, 0, }, /* 391 */ + { 32, 23, 12, 0, 0, 32, 0, }, /* 392 */ + { 32, 13, 12, 0, 0, 32, 0, }, /* 393 */ + { 32, 15, 12, 0, 0, 32, 0, }, /* 394 */ + { 38, 21, 12, 0, 0, 38, 0, }, /* 395 */ + { 10, 21, 12, 0, 0, -70, 0, }, /* 396 */ + { 38, 17, 12, 0, 0, 38, 0, }, /* 397 */ + { 38, 12, 3, 0, 0, 38, 0, }, /* 398 */ + { 38, 1, 2, 0, 0, 38, 0, }, /* 399 */ + { 38, 13, 12, 0, 0, 38, 0, }, /* 400 */ + { 38, 7, 12, 0, 0, 38, 0, }, /* 401 */ + { 38, 6, 12, 0, 0, 38, 0, }, /* 402 */ + { 35, 7, 12, 0, 0, 35, 0, }, /* 403 */ + { 35, 12, 3, 0, 0, 35, 0, }, /* 404 */ + { 35, 10, 5, 0, 0, 35, 0, }, /* 405 */ + { 35, 26, 12, 0, 0, 35, 0, }, /* 406 */ + { 35, 21, 12, 0, 0, 35, 0, }, /* 407 */ + { 35, 13, 12, 0, 0, 35, 0, }, /* 408 */ + { 53, 7, 12, 0, 0, 53, 0, }, /* 409 */ + { 40, 7, 12, 0, 0, 40, 0, }, /* 410 */ + { 40, 13, 12, 0, 0, 40, 0, }, /* 411 */ + { 40, 15, 12, 0, 0, 40, 0, }, /* 412 */ + { 40, 26, 12, 0, 0, 40, 0, }, /* 413 */ + { 32, 26, 12, 0, 0, 32, 0, }, /* 414 */ + { 6, 7, 12, 0, 0, 6, 0, }, /* 415 */ + { 6, 12, 3, 0, 0, 6, 0, }, /* 416 */ + { 6, 10, 5, 0, 0, 6, 0, }, /* 417 */ + { 6, 21, 12, 0, 0, 6, 0, }, /* 418 */ + { 91, 7, 12, 0, 0, 91, 0, }, /* 419 */ + { 91, 10, 5, 0, 0, 91, 0, }, /* 420 */ + { 91, 12, 3, 0, 0, 91, 0, }, /* 421 */ + { 91, 10, 12, 0, 0, 91, 0, }, /* 422 */ + { 91, 13, 12, 0, 0, 91, 0, }, /* 423 */ + { 91, 21, 12, 0, 0, 91, 0, }, /* 424 */ + { 91, 6, 12, 0, 0, 91, 0, }, /* 425 */ + { 28, 11, 3, 0, 0, 28, 0, }, /* 426 */ + { 62, 12, 3, 0, 0, 62, 0, }, /* 427 */ + { 62, 10, 5, 0, 0, 62, 0, }, /* 428 */ + { 62, 7, 12, 0, 0, 62, 0, }, /* 429 */ + { 62, 10, 3, 0, 0, 62, 0, }, /* 430 */ + { 62, 13, 12, 0, 0, 62, 0, }, /* 431 */ + { 62, 21, 12, 0, 0, 62, 0, }, /* 432 */ + { 62, 26, 12, 0, 0, 62, 0, }, /* 433 */ + { 76, 12, 3, 0, 0, 76, 0, }, /* 434 */ + { 76, 10, 5, 0, 0, 76, 0, }, /* 435 */ + { 76, 7, 12, 0, 0, 76, 0, }, /* 436 */ + { 76, 13, 12, 0, 0, 76, 0, }, /* 437 */ + { 93, 7, 12, 0, 0, 93, 0, }, /* 438 */ + { 93, 12, 3, 0, 0, 93, 0, }, /* 439 */ + { 93, 10, 5, 0, 0, 93, 0, }, /* 440 */ + { 93, 21, 12, 0, 0, 93, 0, }, /* 441 */ + { 70, 7, 12, 0, 0, 70, 0, }, /* 442 */ + { 70, 10, 5, 0, 0, 70, 0, }, /* 443 */ + { 70, 12, 3, 0, 0, 70, 0, }, /* 444 */ + { 70, 21, 12, 0, 0, 70, 0, }, /* 445 */ + { 70, 13, 12, 0, 0, 70, 0, }, /* 446 */ + { 73, 13, 12, 0, 0, 73, 0, }, /* 447 */ + { 73, 7, 12, 0, 0, 73, 0, }, /* 448 */ + { 73, 6, 12, 0, 0, 73, 0, }, /* 449 */ + { 73, 21, 12, 0, 0, 73, 0, }, /* 450 */ + { 13, 5, 12, 63, -6222, 13, 0, }, /* 451 */ + { 13, 5, 12, 67, -6221, 13, 0, }, /* 452 */ + { 13, 5, 12, 71, -6212, 13, 0, }, /* 453 */ + { 13, 5, 12, 75, -6210, 13, 0, }, /* 454 */ + { 13, 5, 12, 79, -6210, 13, 0, }, /* 455 */ + { 13, 5, 12, 79, -6211, 13, 0, }, /* 456 */ + { 13, 5, 12, 84, -6204, 13, 0, }, /* 457 */ + { 13, 5, 12, 88, -6180, 13, 0, }, /* 458 */ + { 13, 5, 12, 108, 35267, 13, 0, }, /* 459 */ + { 17, 9, 12, 0, -3008, 17, 0, }, /* 460 */ + { 76, 21, 12, 0, 0, 76, 0, }, /* 461 */ + { 28, 12, 3, 0, 0, -110, 0, }, /* 462 */ + { 28, 12, 3, 0, 0, 15, 0, }, /* 463 */ + { 10, 21, 12, 0, 0, -37, 0, }, /* 464 */ + { 28, 12, 3, 0, 0, -16, 0, }, /* 465 */ + { 28, 12, 3, 0, 0, -43, 0, }, /* 466 */ + { 28, 12, 3, 0, 0, -138, 0, }, /* 467 */ + { 10, 10, 5, 0, 0, -16, 0, }, /* 468 */ + { 10, 7, 12, 0, 0, -40, 0, }, /* 469 */ + { 10, 7, 12, 0, 0, -16, 0, }, /* 470 */ + { 10, 7, 12, 0, 0, 15, 0, }, /* 471 */ + { 10, 7, 12, 0, 0, -154, 0, }, /* 472 */ + { 10, 7, 12, 0, 0, -37, 0, }, /* 473 */ + { 28, 12, 3, 0, 0, -89, 0, }, /* 474 */ + { 10, 10, 5, 0, 0, 3, 0, }, /* 475 */ + { 28, 12, 3, 0, 0, -37, 0, }, /* 476 */ + { 10, 7, 12, 0, 0, 150, 0, }, /* 477 */ + { 13, 5, 12, 0, 0, 13, 0, }, /* 478 */ + { 13, 6, 12, 0, 0, 13, 0, }, /* 479 */ + { 34, 5, 12, 0, 35332, 34, 0, }, /* 480 */ + { 34, 5, 12, 0, 3814, 34, 0, }, /* 481 */ + { 34, 5, 12, 0, 35384, 34, 0, }, /* 482 */ + { 34, 9, 12, 92, 1, 34, 0, }, /* 483 */ + { 34, 5, 12, 92, -1, 34, 0, }, /* 484 */ + { 34, 5, 12, 92, -58, 34, 0, }, /* 485 */ + { 34, 9, 12, 0, -7615, 34, 0, }, /* 486 */ + { 20, 5, 12, 0, 8, 20, 0, }, /* 487 */ + { 20, 9, 12, 0, -8, 20, 0, }, /* 488 */ + { 20, 5, 12, 0, 74, 20, 0, }, /* 489 */ + { 20, 5, 12, 0, 86, 20, 0, }, /* 490 */ + { 20, 5, 12, 0, 100, 20, 0, }, /* 491 */ + { 20, 5, 12, 0, 128, 20, 0, }, /* 492 */ + { 20, 5, 12, 0, 112, 20, 0, }, /* 493 */ + { 20, 5, 12, 0, 126, 20, 0, }, /* 494 */ + { 20, 8, 12, 0, -8, 20, 0, }, /* 495 */ + { 20, 5, 12, 0, 9, 20, 0, }, /* 496 */ + { 20, 9, 12, 0, -74, 20, 0, }, /* 497 */ + { 20, 8, 12, 0, -9, 20, 0, }, /* 498 */ + { 20, 5, 12, 21, -7173, 20, 0, }, /* 499 */ + { 20, 9, 12, 0, -86, 20, 0, }, /* 500 */ + { 20, 9, 12, 0, -100, 20, 0, }, /* 501 */ + { 20, 9, 12, 0, -112, 20, 0, }, /* 502 */ + { 20, 9, 12, 0, -128, 20, 0, }, /* 503 */ + { 20, 9, 12, 0, -126, 20, 0, }, /* 504 */ + { 28, 1, 3, 0, 0, 28, 0, }, /* 505 */ + { 28, 1, 13, 0, 0, 28, 0, }, /* 506 */ + { 10, 27, 2, 0, 0, 10, 0, }, /* 507 */ + { 10, 28, 2, 0, 0, 10, 0, }, /* 508 */ + { 10, 29, 12, 0, 0, -67, 0, }, /* 509 */ + { 10, 21, 14, 0, 0, 10, 0, }, /* 510 */ + { 0, 2, 2, 0, 0, 0, 0, }, /* 511 */ + { 28, 12, 3, 0, 0, -93, 0, }, /* 512 */ + { 10, 9, 12, 0, 0, 10, 0, }, /* 513 */ + { 10, 5, 12, 0, 0, 10, 0, }, /* 514 */ + { 20, 9, 12, 96, -7517, 20, 0, }, /* 515 */ + { 34, 9, 12, 100, -8383, 34, 0, }, /* 516 */ + { 34, 9, 12, 104, -8262, 34, 0, }, /* 517 */ + { 34, 9, 12, 0, 28, 34, 0, }, /* 518 */ + { 10, 7, 12, 0, 0, 10, 0, }, /* 519 */ + { 10, 5, 14, 0, 0, 10, 0, }, /* 520 */ + { 34, 5, 12, 0, -28, 34, 0, }, /* 521 */ + { 34, 14, 12, 0, 16, 34, 0, }, /* 522 */ + { 34, 14, 12, 0, -16, 34, 0, }, /* 523 */ + { 34, 14, 12, 0, 0, 34, 0, }, /* 524 */ + { 10, 25, 14, 0, 0, 10, 0, }, /* 525 */ + { 10, 26, 12, 0, 26, 10, 0, }, /* 526 */ + { 10, 26, 14, 0, 26, 10, 0, }, /* 527 */ + { 10, 26, 12, 0, -26, 10, 0, }, /* 528 */ + { 5, 26, 12, 0, 0, 5, 0, }, /* 529 */ + { 18, 9, 12, 0, 48, 18, 0, }, /* 530 */ + { 18, 5, 12, 0, -48, 18, 0, }, /* 531 */ + { 34, 9, 12, 0, -10743, 34, 0, }, /* 532 */ + { 34, 9, 12, 0, -3814, 34, 0, }, /* 533 */ + { 34, 9, 12, 0, -10727, 34, 0, }, /* 534 */ + { 34, 5, 12, 0, -10795, 34, 0, }, /* 535 */ + { 34, 5, 12, 0, -10792, 34, 0, }, /* 536 */ + { 34, 9, 12, 0, -10780, 34, 0, }, /* 537 */ + { 34, 9, 12, 0, -10749, 34, 0, }, /* 538 */ + { 34, 9, 12, 0, -10783, 34, 0, }, /* 539 */ + { 34, 9, 12, 0, -10782, 34, 0, }, /* 540 */ + { 34, 9, 12, 0, -10815, 34, 0, }, /* 541 */ + { 11, 5, 12, 0, 0, 11, 0, }, /* 542 */ + { 11, 26, 12, 0, 0, 11, 0, }, /* 543 */ + { 11, 12, 3, 0, 0, 11, 0, }, /* 544 */ + { 11, 21, 12, 0, 0, 11, 0, }, /* 545 */ + { 11, 15, 12, 0, 0, 11, 0, }, /* 546 */ + { 17, 5, 12, 0, -7264, 17, 0, }, /* 547 */ + { 59, 7, 12, 0, 0, 59, 0, }, /* 548 */ + { 59, 6, 12, 0, 0, 59, 0, }, /* 549 */ + { 59, 21, 12, 0, 0, 59, 0, }, /* 550 */ + { 59, 12, 3, 0, 0, 59, 0, }, /* 551 */ + { 13, 12, 3, 0, 0, 13, 0, }, /* 552 */ + { 10, 21, 12, 0, 0, -28, 0, }, /* 553 */ + { 23, 26, 12, 0, 0, 23, 0, }, /* 554 */ + { 10, 21, 12, 0, 0, -131, 0, }, /* 555 */ + { 10, 21, 12, 0, 0, -125, 0, }, /* 556 */ + { 23, 6, 12, 0, 0, 23, 0, }, /* 557 */ + { 10, 7, 12, 0, 0, 23, 0, }, /* 558 */ + { 23, 14, 12, 0, 0, 23, 0, }, /* 559 */ + { 10, 22, 12, 0, 0, -131, 0, }, /* 560 */ + { 10, 18, 12, 0, 0, -131, 0, }, /* 561 */ + { 10, 26, 12, 0, 0, -125, 0, }, /* 562 */ + { 10, 17, 12, 0, 0, -125, 0, }, /* 563 */ + { 10, 22, 12, 0, 0, -125, 0, }, /* 564 */ + { 10, 18, 12, 0, 0, -125, 0, }, /* 565 */ + { 28, 12, 3, 0, 0, -19, 0, }, /* 566 */ + { 24, 10, 3, 0, 0, 24, 0, }, /* 567 */ + { 10, 17, 14, 0, 0, -125, 0, }, /* 568 */ + { 10, 6, 12, 0, 0, -61, 0, }, /* 569 */ + { 10, 7, 12, 0, 0, -97, 0, }, /* 570 */ + { 10, 21, 14, 0, 0, -97, 0, }, /* 571 */ + { 10, 26, 12, 0, 0, 23, 0, }, /* 572 */ + { 27, 7, 12, 0, 0, 27, 0, }, /* 573 */ + { 28, 12, 3, 0, 0, -61, 0, }, /* 574 */ + { 10, 24, 12, 0, 0, -61, 0, }, /* 575 */ + { 27, 6, 12, 0, 0, 27, 0, }, /* 576 */ + { 10, 17, 12, 0, 0, -61, 0, }, /* 577 */ + { 30, 7, 12, 0, 0, 30, 0, }, /* 578 */ + { 30, 6, 12, 0, 0, 30, 0, }, /* 579 */ + { 4, 7, 12, 0, 0, 4, 0, }, /* 580 */ + { 24, 7, 12, 0, 0, 24, 0, }, /* 581 */ + { 10, 15, 12, 0, 0, 23, 0, }, /* 582 */ + { 24, 26, 12, 0, 0, 24, 0, }, /* 583 */ + { 10, 26, 14, 0, 0, 23, 0, }, /* 584 */ + { 30, 26, 12, 0, 0, 30, 0, }, /* 585 */ + { 23, 7, 12, 0, 0, 23, 0, }, /* 586 */ + { 61, 7, 12, 0, 0, 61, 0, }, /* 587 */ + { 61, 6, 12, 0, 0, 61, 0, }, /* 588 */ + { 61, 26, 12, 0, 0, 61, 0, }, /* 589 */ + { 86, 7, 12, 0, 0, 86, 0, }, /* 590 */ + { 86, 6, 12, 0, 0, 86, 0, }, /* 591 */ + { 86, 21, 12, 0, 0, 86, 0, }, /* 592 */ + { 77, 7, 12, 0, 0, 77, 0, }, /* 593 */ + { 77, 6, 12, 0, 0, 77, 0, }, /* 594 */ + { 77, 21, 12, 0, 0, 77, 0, }, /* 595 */ + { 77, 13, 12, 0, 0, 77, 0, }, /* 596 */ + { 13, 9, 12, 108, 1, 13, 0, }, /* 597 */ + { 13, 5, 12, 108, -35267, 13, 0, }, /* 598 */ + { 13, 7, 12, 0, 0, 13, 0, }, /* 599 */ + { 13, 21, 12, 0, 0, 13, 0, }, /* 600 */ + { 79, 7, 12, 0, 0, 79, 0, }, /* 601 */ + { 79, 14, 12, 0, 0, 79, 0, }, /* 602 */ + { 79, 12, 3, 0, 0, 79, 0, }, /* 603 */ + { 79, 21, 12, 0, 0, 79, 0, }, /* 604 */ + { 34, 9, 12, 0, -35332, 34, 0, }, /* 605 */ + { 34, 9, 12, 0, -42280, 34, 0, }, /* 606 */ + { 34, 5, 12, 0, 48, 34, 0, }, /* 607 */ + { 34, 9, 12, 0, -42308, 34, 0, }, /* 608 */ + { 34, 9, 12, 0, -42319, 34, 0, }, /* 609 */ + { 34, 9, 12, 0, -42315, 34, 0, }, /* 610 */ + { 34, 9, 12, 0, -42305, 34, 0, }, /* 611 */ + { 34, 9, 12, 0, -42258, 34, 0, }, /* 612 */ + { 34, 9, 12, 0, -42282, 34, 0, }, /* 613 */ + { 34, 9, 12, 0, -42261, 34, 0, }, /* 614 */ + { 34, 9, 12, 0, 928, 34, 0, }, /* 615 */ + { 34, 9, 12, 0, -48, 34, 0, }, /* 616 */ + { 34, 9, 12, 0, -42307, 34, 0, }, /* 617 */ + { 34, 9, 12, 0, -35384, 34, 0, }, /* 618 */ + { 49, 7, 12, 0, 0, 49, 0, }, /* 619 */ + { 49, 12, 3, 0, 0, 49, 0, }, /* 620 */ + { 49, 10, 5, 0, 0, 49, 0, }, /* 621 */ + { 49, 26, 12, 0, 0, 49, 0, }, /* 622 */ + { 10, 15, 12, 0, 0, -216, 0, }, /* 623 */ + { 10, 15, 12, 0, 0, -202, 0, }, /* 624 */ + { 10, 26, 12, 0, 0, -163, 0, }, /* 625 */ + { 10, 23, 12, 0, 0, -163, 0, }, /* 626 */ + { 65, 7, 12, 0, 0, 65, 0, }, /* 627 */ + { 65, 21, 12, 0, 0, 65, 0, }, /* 628 */ + { 75, 10, 5, 0, 0, 75, 0, }, /* 629 */ + { 75, 7, 12, 0, 0, 75, 0, }, /* 630 */ + { 75, 12, 3, 0, 0, 75, 0, }, /* 631 */ + { 75, 21, 12, 0, 0, 75, 0, }, /* 632 */ + { 75, 13, 12, 0, 0, 75, 0, }, /* 633 */ + { 15, 12, 3, 0, 0, -16, 0, }, /* 634 */ + { 15, 7, 12, 0, 0, -46, 0, }, /* 635 */ + { 69, 13, 12, 0, 0, 69, 0, }, /* 636 */ + { 69, 7, 12, 0, 0, 69, 0, }, /* 637 */ + { 69, 12, 3, 0, 0, 69, 0, }, /* 638 */ + { 10, 21, 12, 0, 0, -101, 0, }, /* 639 */ + { 69, 21, 12, 0, 0, 69, 0, }, /* 640 */ + { 74, 7, 12, 0, 0, 74, 0, }, /* 641 */ + { 74, 12, 3, 0, 0, 74, 0, }, /* 642 */ + { 74, 10, 5, 0, 0, 74, 0, }, /* 643 */ + { 74, 21, 12, 0, 0, 74, 0, }, /* 644 */ + { 84, 12, 3, 0, 0, 84, 0, }, /* 645 */ + { 84, 10, 5, 0, 0, 84, 0, }, /* 646 */ + { 84, 7, 12, 0, 0, 84, 0, }, /* 647 */ + { 84, 21, 12, 0, 0, 84, 0, }, /* 648 */ + { 10, 6, 12, 0, 0, -22, 0, }, /* 649 */ + { 84, 13, 12, 0, 0, 84, 0, }, /* 650 */ + { 39, 6, 12, 0, 0, 39, 0, }, /* 651 */ + { 68, 7, 12, 0, 0, 68, 0, }, /* 652 */ + { 68, 12, 3, 0, 0, 68, 0, }, /* 653 */ + { 68, 10, 5, 0, 0, 68, 0, }, /* 654 */ + { 68, 13, 12, 0, 0, 68, 0, }, /* 655 */ + { 68, 21, 12, 0, 0, 68, 0, }, /* 656 */ + { 92, 7, 12, 0, 0, 92, 0, }, /* 657 */ + { 92, 12, 3, 0, 0, 92, 0, }, /* 658 */ + { 92, 6, 12, 0, 0, 92, 0, }, /* 659 */ + { 92, 21, 12, 0, 0, 92, 0, }, /* 660 */ + { 87, 7, 12, 0, 0, 87, 0, }, /* 661 */ + { 87, 10, 5, 0, 0, 87, 0, }, /* 662 */ + { 87, 12, 3, 0, 0, 87, 0, }, /* 663 */ + { 87, 21, 12, 0, 0, 87, 0, }, /* 664 */ + { 87, 6, 12, 0, 0, 87, 0, }, /* 665 */ + { 34, 5, 12, 0, -928, 34, 0, }, /* 666 */ + { 9, 5, 12, 0, -38864, 9, 0, }, /* 667 */ + { 87, 13, 12, 0, 0, 87, 0, }, /* 668 */ + { 24, 7, 9, 0, 0, 24, 0, }, /* 669 */ + { 24, 7, 10, 0, 0, 24, 0, }, /* 670 */ + { 0, 4, 12, 0, 0, 0, 0, }, /* 671 */ + { 0, 3, 12, 0, 0, 0, 0, }, /* 672 */ + { 26, 25, 12, 0, 0, 26, 0, }, /* 673 */ + { 1, 24, 12, 0, 0, 1, 0, }, /* 674 */ + { 1, 7, 12, 0, 0, -10, 0, }, /* 675 */ + { 1, 26, 12, 0, 0, -10, 0, }, /* 676 */ + { 10, 6, 3, 0, 0, -61, 0, }, /* 677 */ + { 36, 7, 12, 0, 0, 36, 0, }, /* 678 */ + { 10, 21, 12, 0, 0, -25, 0, }, /* 679 */ + { 10, 15, 12, 0, 0, -85, 0, }, /* 680 */ + { 10, 26, 12, 0, 0, -25, 0, }, /* 681 */ + { 20, 14, 12, 0, 0, 20, 0, }, /* 682 */ + { 20, 15, 12, 0, 0, 20, 0, }, /* 683 */ + { 20, 26, 12, 0, 0, 20, 0, }, /* 684 */ + { 71, 7, 12, 0, 0, 71, 0, }, /* 685 */ + { 67, 7, 12, 0, 0, 67, 0, }, /* 686 */ + { 28, 12, 3, 0, 0, -1, 0, }, /* 687 */ + { 10, 15, 12, 0, 0, -1, 0, }, /* 688 */ + { 42, 7, 12, 0, 0, 42, 0, }, /* 689 */ + { 42, 15, 12, 0, 0, 42, 0, }, /* 690 */ + { 19, 7, 12, 0, 0, 19, 0, }, /* 691 */ + { 19, 14, 12, 0, 0, 19, 0, }, /* 692 */ + { 118, 7, 12, 0, 0, 118, 0, }, /* 693 */ + { 118, 12, 3, 0, 0, 118, 0, }, /* 694 */ + { 60, 7, 12, 0, 0, 60, 0, }, /* 695 */ + { 60, 21, 12, 0, 0, 60, 0, }, /* 696 */ + { 43, 7, 12, 0, 0, 43, 0, }, /* 697 */ + { 43, 21, 12, 0, 0, 43, 0, }, /* 698 */ + { 43, 14, 12, 0, 0, 43, 0, }, /* 699 */ + { 14, 9, 12, 0, 40, 14, 0, }, /* 700 */ + { 14, 5, 12, 0, -40, 14, 0, }, /* 701 */ + { 47, 7, 12, 0, 0, 47, 0, }, /* 702 */ + { 45, 7, 12, 0, 0, 45, 0, }, /* 703 */ + { 45, 13, 12, 0, 0, 45, 0, }, /* 704 */ + { 136, 9, 12, 0, 40, 136, 0, }, /* 705 */ + { 136, 5, 12, 0, -40, 136, 0, }, /* 706 */ + { 106, 7, 12, 0, 0, 106, 0, }, /* 707 */ + { 104, 7, 12, 0, 0, 104, 0, }, /* 708 */ + { 104, 21, 12, 0, 0, 104, 0, }, /* 709 */ + { 110, 7, 12, 0, 0, 110, 0, }, /* 710 */ + { 12, 7, 12, 0, 0, 12, 0, }, /* 711 */ + { 81, 7, 12, 0, 0, 81, 0, }, /* 712 */ + { 81, 21, 12, 0, 0, 81, 0, }, /* 713 */ + { 81, 15, 12, 0, 0, 81, 0, }, /* 714 */ + { 120, 7, 12, 0, 0, 120, 0, }, /* 715 */ + { 120, 26, 12, 0, 0, 120, 0, }, /* 716 */ + { 120, 15, 12, 0, 0, 120, 0, }, /* 717 */ + { 116, 7, 12, 0, 0, 116, 0, }, /* 718 */ + { 116, 15, 12, 0, 0, 116, 0, }, /* 719 */ + { 128, 7, 12, 0, 0, 128, 0, }, /* 720 */ + { 128, 15, 12, 0, 0, 128, 0, }, /* 721 */ + { 66, 7, 12, 0, 0, 66, 0, }, /* 722 */ + { 66, 15, 12, 0, 0, 66, 0, }, /* 723 */ + { 66, 21, 12, 0, 0, 66, 0, }, /* 724 */ + { 72, 7, 12, 0, 0, 72, 0, }, /* 725 */ + { 72, 21, 12, 0, 0, 72, 0, }, /* 726 */ + { 98, 7, 12, 0, 0, 98, 0, }, /* 727 */ + { 97, 7, 12, 0, 0, 97, 0, }, /* 728 */ + { 97, 15, 12, 0, 0, 97, 0, }, /* 729 */ + { 31, 7, 12, 0, 0, 31, 0, }, /* 730 */ + { 31, 12, 3, 0, 0, 31, 0, }, /* 731 */ + { 31, 15, 12, 0, 0, 31, 0, }, /* 732 */ + { 31, 21, 12, 0, 0, 31, 0, }, /* 733 */ + { 88, 7, 12, 0, 0, 88, 0, }, /* 734 */ + { 88, 15, 12, 0, 0, 88, 0, }, /* 735 */ + { 88, 21, 12, 0, 0, 88, 0, }, /* 736 */ + { 117, 7, 12, 0, 0, 117, 0, }, /* 737 */ + { 117, 15, 12, 0, 0, 117, 0, }, /* 738 */ + { 112, 7, 12, 0, 0, 112, 0, }, /* 739 */ + { 112, 26, 12, 0, 0, 112, 0, }, /* 740 */ + { 112, 12, 3, 0, 0, 112, 0, }, /* 741 */ + { 112, 15, 12, 0, 0, 112, 0, }, /* 742 */ + { 112, 21, 12, 0, 0, 112, 0, }, /* 743 */ + { 78, 7, 12, 0, 0, 78, 0, }, /* 744 */ + { 78, 21, 12, 0, 0, 78, 0, }, /* 745 */ + { 83, 7, 12, 0, 0, 83, 0, }, /* 746 */ + { 83, 15, 12, 0, 0, 83, 0, }, /* 747 */ + { 82, 7, 12, 0, 0, 82, 0, }, /* 748 */ + { 82, 15, 12, 0, 0, 82, 0, }, /* 749 */ + { 121, 7, 12, 0, 0, 121, 0, }, /* 750 */ + { 121, 21, 12, 0, 0, 121, 0, }, /* 751 */ + { 121, 15, 12, 0, 0, 121, 0, }, /* 752 */ + { 89, 7, 12, 0, 0, 89, 0, }, /* 753 */ + { 130, 9, 12, 0, 64, 130, 0, }, /* 754 */ + { 130, 5, 12, 0, -64, 130, 0, }, /* 755 */ + { 130, 15, 12, 0, 0, 130, 0, }, /* 756 */ + { 144, 7, 12, 0, 0, 144, 0, }, /* 757 */ + { 144, 12, 3, 0, 0, 144, 0, }, /* 758 */ + { 144, 13, 12, 0, 0, 144, 0, }, /* 759 */ + { 1, 15, 12, 0, 0, 1, 0, }, /* 760 */ + { 147, 7, 12, 0, 0, 147, 0, }, /* 761 */ + { 147, 15, 12, 0, 0, 147, 0, }, /* 762 */ + { 148, 7, 12, 0, 0, 148, 0, }, /* 763 */ + { 148, 12, 3, 0, 0, 148, 0, }, /* 764 */ + { 148, 15, 12, 0, 0, 148, 0, }, /* 765 */ + { 148, 21, 12, 0, 0, 148, 0, }, /* 766 */ + { 149, 7, 12, 0, 0, 149, 0, }, /* 767 */ + { 94, 10, 5, 0, 0, 94, 0, }, /* 768 */ + { 94, 12, 3, 0, 0, 94, 0, }, /* 769 */ + { 94, 7, 12, 0, 0, 94, 0, }, /* 770 */ + { 94, 21, 12, 0, 0, 94, 0, }, /* 771 */ + { 94, 15, 12, 0, 0, 94, 0, }, /* 772 */ + { 94, 13, 12, 0, 0, 94, 0, }, /* 773 */ + { 85, 12, 3, 0, 0, 85, 0, }, /* 774 */ + { 85, 10, 5, 0, 0, 85, 0, }, /* 775 */ + { 85, 7, 12, 0, 0, 85, 0, }, /* 776 */ + { 85, 21, 12, 0, 0, 85, 0, }, /* 777 */ + { 85, 1, 4, 0, 0, 85, 0, }, /* 778 */ + { 101, 7, 12, 0, 0, 101, 0, }, /* 779 */ + { 101, 13, 12, 0, 0, 101, 0, }, /* 780 */ + { 96, 12, 3, 0, 0, 96, 0, }, /* 781 */ + { 96, 7, 12, 0, 0, 96, 0, }, /* 782 */ + { 96, 10, 5, 0, 0, 96, 0, }, /* 783 */ + { 96, 13, 12, 0, 0, 96, 0, }, /* 784 */ + { 96, 21, 12, 0, 0, 96, 0, }, /* 785 */ + { 111, 7, 12, 0, 0, 111, 0, }, /* 786 */ + { 111, 12, 3, 0, 0, 111, 0, }, /* 787 */ + { 111, 21, 12, 0, 0, 111, 0, }, /* 788 */ + { 100, 12, 3, 0, 0, 100, 0, }, /* 789 */ + { 100, 10, 5, 0, 0, 100, 0, }, /* 790 */ + { 100, 7, 12, 0, 0, 100, 0, }, /* 791 */ + { 100, 7, 4, 0, 0, 100, 0, }, /* 792 */ + { 100, 21, 12, 0, 0, 100, 0, }, /* 793 */ + { 100, 13, 12, 0, 0, 100, 0, }, /* 794 */ + { 48, 15, 12, 0, 0, 48, 0, }, /* 795 */ + { 108, 7, 12, 0, 0, 108, 0, }, /* 796 */ + { 108, 10, 5, 0, 0, 108, 0, }, /* 797 */ + { 108, 12, 3, 0, 0, 108, 0, }, /* 798 */ + { 108, 21, 12, 0, 0, 108, 0, }, /* 799 */ + { 129, 7, 12, 0, 0, 129, 0, }, /* 800 */ + { 129, 21, 12, 0, 0, 129, 0, }, /* 801 */ + { 109, 7, 12, 0, 0, 109, 0, }, /* 802 */ + { 109, 12, 3, 0, 0, 109, 0, }, /* 803 */ + { 109, 10, 5, 0, 0, 109, 0, }, /* 804 */ + { 109, 13, 12, 0, 0, 109, 0, }, /* 805 */ + { 107, 12, 3, 0, 0, 107, 0, }, /* 806 */ + { 107, 12, 3, 0, 0, -52, 0, }, /* 807 */ + { 107, 10, 5, 0, 0, 107, 0, }, /* 808 */ + { 107, 10, 5, 0, 0, -52, 0, }, /* 809 */ + { 107, 7, 12, 0, 0, 107, 0, }, /* 810 */ + { 28, 12, 3, 0, 0, -52, 0, }, /* 811 */ + { 107, 10, 3, 0, 0, 107, 0, }, /* 812 */ + { 135, 7, 12, 0, 0, 135, 0, }, /* 813 */ + { 135, 10, 5, 0, 0, 135, 0, }, /* 814 */ + { 135, 12, 3, 0, 0, 135, 0, }, /* 815 */ + { 135, 21, 12, 0, 0, 135, 0, }, /* 816 */ + { 135, 13, 12, 0, 0, 135, 0, }, /* 817 */ + { 124, 7, 12, 0, 0, 124, 0, }, /* 818 */ + { 124, 10, 3, 0, 0, 124, 0, }, /* 819 */ + { 124, 10, 5, 0, 0, 124, 0, }, /* 820 */ + { 124, 12, 3, 0, 0, 124, 0, }, /* 821 */ + { 124, 21, 12, 0, 0, 124, 0, }, /* 822 */ + { 124, 13, 12, 0, 0, 124, 0, }, /* 823 */ + { 123, 7, 12, 0, 0, 123, 0, }, /* 824 */ + { 123, 10, 3, 0, 0, 123, 0, }, /* 825 */ + { 123, 10, 5, 0, 0, 123, 0, }, /* 826 */ + { 123, 12, 3, 0, 0, 123, 0, }, /* 827 */ + { 123, 21, 12, 0, 0, 123, 0, }, /* 828 */ + { 114, 7, 12, 0, 0, 114, 0, }, /* 829 */ + { 114, 10, 5, 0, 0, 114, 0, }, /* 830 */ + { 114, 12, 3, 0, 0, 114, 0, }, /* 831 */ + { 114, 21, 12, 0, 0, 114, 0, }, /* 832 */ + { 114, 13, 12, 0, 0, 114, 0, }, /* 833 */ + { 102, 7, 12, 0, 0, 102, 0, }, /* 834 */ + { 102, 12, 3, 0, 0, 102, 0, }, /* 835 */ + { 102, 10, 5, 0, 0, 102, 0, }, /* 836 */ + { 102, 13, 12, 0, 0, 102, 0, }, /* 837 */ + { 126, 7, 12, 0, 0, 126, 0, }, /* 838 */ + { 126, 12, 3, 0, 0, 126, 0, }, /* 839 */ + { 126, 10, 5, 0, 0, 126, 0, }, /* 840 */ + { 126, 13, 12, 0, 0, 126, 0, }, /* 841 */ + { 126, 15, 12, 0, 0, 126, 0, }, /* 842 */ + { 126, 21, 12, 0, 0, 126, 0, }, /* 843 */ + { 126, 26, 12, 0, 0, 126, 0, }, /* 844 */ + { 142, 7, 12, 0, 0, 142, 0, }, /* 845 */ + { 142, 10, 5, 0, 0, 142, 0, }, /* 846 */ + { 142, 12, 3, 0, 0, 142, 0, }, /* 847 */ + { 142, 21, 12, 0, 0, 142, 0, }, /* 848 */ + { 125, 9, 12, 0, 32, 125, 0, }, /* 849 */ + { 125, 5, 12, 0, -32, 125, 0, }, /* 850 */ + { 125, 13, 12, 0, 0, 125, 0, }, /* 851 */ + { 125, 15, 12, 0, 0, 125, 0, }, /* 852 */ + { 125, 7, 12, 0, 0, 125, 0, }, /* 853 */ + { 150, 7, 12, 0, 0, 150, 0, }, /* 854 */ + { 150, 10, 5, 0, 0, 150, 0, }, /* 855 */ + { 150, 12, 3, 0, 0, 150, 0, }, /* 856 */ + { 150, 21, 12, 0, 0, 150, 0, }, /* 857 */ + { 141, 7, 12, 0, 0, 141, 0, }, /* 858 */ + { 141, 12, 3, 0, 0, 141, 0, }, /* 859 */ + { 141, 10, 5, 0, 0, 141, 0, }, /* 860 */ + { 141, 7, 4, 0, 0, 141, 0, }, /* 861 */ + { 141, 21, 12, 0, 0, 141, 0, }, /* 862 */ + { 140, 7, 12, 0, 0, 140, 0, }, /* 863 */ + { 140, 12, 3, 0, 0, 140, 0, }, /* 864 */ + { 140, 10, 5, 0, 0, 140, 0, }, /* 865 */ + { 140, 7, 4, 0, 0, 140, 0, }, /* 866 */ + { 140, 21, 12, 0, 0, 140, 0, }, /* 867 */ + { 122, 7, 12, 0, 0, 122, 0, }, /* 868 */ + { 133, 7, 12, 0, 0, 133, 0, }, /* 869 */ + { 133, 10, 5, 0, 0, 133, 0, }, /* 870 */ + { 133, 12, 3, 0, 0, 133, 0, }, /* 871 */ + { 133, 21, 12, 0, 0, 133, 0, }, /* 872 */ + { 133, 13, 12, 0, 0, 133, 0, }, /* 873 */ + { 133, 15, 12, 0, 0, 133, 0, }, /* 874 */ + { 134, 21, 12, 0, 0, 134, 0, }, /* 875 */ + { 134, 7, 12, 0, 0, 134, 0, }, /* 876 */ + { 134, 12, 3, 0, 0, 134, 0, }, /* 877 */ + { 134, 10, 5, 0, 0, 134, 0, }, /* 878 */ + { 138, 7, 12, 0, 0, 138, 0, }, /* 879 */ + { 138, 12, 3, 0, 0, 138, 0, }, /* 880 */ + { 138, 7, 4, 0, 0, 138, 0, }, /* 881 */ + { 138, 13, 12, 0, 0, 138, 0, }, /* 882 */ + { 143, 7, 12, 0, 0, 143, 0, }, /* 883 */ + { 143, 10, 5, 0, 0, 143, 0, }, /* 884 */ + { 143, 12, 3, 0, 0, 143, 0, }, /* 885 */ + { 143, 13, 12, 0, 0, 143, 0, }, /* 886 */ + { 145, 7, 12, 0, 0, 145, 0, }, /* 887 */ + { 145, 12, 3, 0, 0, 145, 0, }, /* 888 */ + { 145, 10, 5, 0, 0, 145, 0, }, /* 889 */ + { 145, 21, 12, 0, 0, 145, 0, }, /* 890 */ + { 54, 15, 12, 0, 0, 54, 0, }, /* 891 */ + { 54, 21, 12, 0, 0, 54, 0, }, /* 892 */ + { 63, 7, 12, 0, 0, 63, 0, }, /* 893 */ + { 63, 14, 12, 0, 0, 63, 0, }, /* 894 */ + { 63, 21, 12, 0, 0, 63, 0, }, /* 895 */ + { 80, 7, 12, 0, 0, 80, 0, }, /* 896 */ + { 80, 1, 2, 0, 0, 80, 0, }, /* 897 */ + { 127, 7, 12, 0, 0, 127, 0, }, /* 898 */ + { 115, 7, 12, 0, 0, 115, 0, }, /* 899 */ + { 115, 13, 12, 0, 0, 115, 0, }, /* 900 */ + { 115, 21, 12, 0, 0, 115, 0, }, /* 901 */ + { 103, 7, 12, 0, 0, 103, 0, }, /* 902 */ + { 103, 12, 3, 0, 0, 103, 0, }, /* 903 */ + { 103, 21, 12, 0, 0, 103, 0, }, /* 904 */ + { 119, 7, 12, 0, 0, 119, 0, }, /* 905 */ + { 119, 12, 3, 0, 0, 119, 0, }, /* 906 */ + { 119, 21, 12, 0, 0, 119, 0, }, /* 907 */ + { 119, 26, 12, 0, 0, 119, 0, }, /* 908 */ + { 119, 6, 12, 0, 0, 119, 0, }, /* 909 */ + { 119, 13, 12, 0, 0, 119, 0, }, /* 910 */ + { 119, 15, 12, 0, 0, 119, 0, }, /* 911 */ + { 146, 9, 12, 0, 32, 146, 0, }, /* 912 */ + { 146, 5, 12, 0, -32, 146, 0, }, /* 913 */ + { 146, 15, 12, 0, 0, 146, 0, }, /* 914 */ + { 146, 21, 12, 0, 0, 146, 0, }, /* 915 */ + { 99, 7, 12, 0, 0, 99, 0, }, /* 916 */ + { 99, 12, 3, 0, 0, 99, 0, }, /* 917 */ + { 99, 10, 5, 0, 0, 99, 0, }, /* 918 */ + { 99, 6, 12, 0, 0, 99, 0, }, /* 919 */ + { 137, 6, 12, 0, 0, 137, 0, }, /* 920 */ + { 139, 6, 12, 0, 0, 139, 0, }, /* 921 */ + { 137, 7, 12, 0, 0, 137, 0, }, /* 922 */ + { 139, 7, 12, 0, 0, 139, 0, }, /* 923 */ + { 105, 7, 12, 0, 0, 105, 0, }, /* 924 */ + { 105, 26, 12, 0, 0, 105, 0, }, /* 925 */ + { 105, 12, 3, 0, 0, 105, 0, }, /* 926 */ + { 105, 21, 12, 0, 0, 105, 0, }, /* 927 */ + { 10, 1, 2, 0, 0, 105, 0, }, /* 928 */ + { 10, 10, 3, 0, 0, 10, 0, }, /* 929 */ + { 10, 10, 5, 0, 0, 10, 0, }, /* 930 */ + { 20, 12, 3, 0, 0, 20, 0, }, /* 931 */ + { 131, 26, 12, 0, 0, 131, 0, }, /* 932 */ + { 131, 12, 3, 0, 0, 131, 0, }, /* 933 */ + { 131, 21, 12, 0, 0, 131, 0, }, /* 934 */ + { 18, 12, 3, 0, 0, 18, 0, }, /* 935 */ + { 151, 7, 12, 0, 0, 151, 0, }, /* 936 */ + { 151, 12, 3, 0, 0, 151, 0, }, /* 937 */ + { 151, 6, 12, 0, 0, 151, 0, }, /* 938 */ + { 151, 13, 12, 0, 0, 151, 0, }, /* 939 */ + { 151, 26, 12, 0, 0, 151, 0, }, /* 940 */ + { 152, 7, 12, 0, 0, 152, 0, }, /* 941 */ + { 152, 12, 3, 0, 0, 152, 0, }, /* 942 */ + { 152, 13, 12, 0, 0, 152, 0, }, /* 943 */ + { 152, 23, 12, 0, 0, 152, 0, }, /* 944 */ + { 113, 7, 12, 0, 0, 113, 0, }, /* 945 */ + { 113, 15, 12, 0, 0, 113, 0, }, /* 946 */ + { 113, 12, 3, 0, 0, 113, 0, }, /* 947 */ + { 132, 9, 12, 0, 34, 132, 0, }, /* 948 */ + { 132, 5, 12, 0, -34, 132, 0, }, /* 949 */ + { 132, 12, 3, 0, 0, 132, 0, }, /* 950 */ + { 132, 6, 12, 0, 0, 132, 0, }, /* 951 */ + { 132, 13, 12, 0, 0, 132, 0, }, /* 952 */ + { 132, 21, 12, 0, 0, 132, 0, }, /* 953 */ + { 0, 2, 14, 0, 0, 0, 0, }, /* 954 */ + { 10, 26, 11, 0, 0, 10, 0, }, /* 955 */ + { 27, 26, 12, 0, 0, 27, 0, }, /* 956 */ + { 10, 24, 3, 0, 0, 10, 0, }, /* 957 */ + { 10, 1, 3, 0, 0, 10, 0, }, /* 958 */ }; const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ @@ -1150,37 +1185,37 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+F000 */ 126,126, 98, 98,127,128,129,130,131,131,132,133,134,135,136,137, /* U+F800 */ 138,139,140,141,142,143,144,145,146,147,148,142,149,149,150,142, /* U+10000 */ -151,152,153,154,155,156,157,158,159,160,161,142,162,142,163,142, /* U+10800 */ -164,165,166,167,168,169,170,142,171,172,142,173,174,175,176,142, /* U+11000 */ -177,178,142,142,179,180,142,142,181,182,183,184,142,185,142,142, /* U+11800 */ -186,186,186,186,186,186,186,187,188,186,189,142,142,142,142,142, /* U+12000 */ +151,152,153,154,155,156,157,158,159,160,161,142,162,142,163,164, /* U+10800 */ +165,166,167,168,169,170,171,142,172,173,142,174,175,176,177,142, /* U+11000 */ +178,179,142,180,181,182,142,142,183,184,185,186,142,187,142,188, /* U+11800 */ +189,189,189,189,189,189,189,190,191,189,192,142,142,142,142,142, /* U+12000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+12800 */ -190,190,190,190,190,190,190,190,191,142,142,142,142,142,142,142, /* U+13000 */ +193,193,193,193,193,193,193,193,194,142,142,142,142,142,142,142, /* U+13000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+13800 */ -142,142,142,142,142,142,142,142,192,192,192,192,193,142,142,142, /* U+14000 */ +142,142,142,142,142,142,142,142,195,195,195,195,196,142,142,142, /* U+14000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+14800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+15000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+15800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+16000 */ -194,194,194,194,195,196,197,198,142,142,142,142,199,200,201,202, /* U+16800 */ -203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* U+17000 */ -203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, /* U+17800 */ -203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,204, /* U+18000 */ -203,203,203,203,203,205,142,142,142,142,142,142,142,142,142,142, /* U+18800 */ +197,197,197,197,198,199,200,201,142,142,142,142,202,203,204,205, /* U+16800 */ +206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* U+17000 */ +206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, /* U+17800 */ +206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,207, /* U+18000 */ +206,206,206,206,206,208,142,142,142,142,142,142,142,142,142,142, /* U+18800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+19000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+19800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1A000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1A800 */ -206,207,208,209,209,210,142,142,142,142,142,142,142,142,142,142, /* U+1B000 */ -142,142,142,142,142,142,142,142,211,212,142,142,142,142,142,142, /* U+1B800 */ +209,210,211,212,212,213,142,142,142,142,142,142,142,142,142,142, /* U+1B000 */ +142,142,142,142,142,142,142,142,214,215,142,142,142,142,142,142, /* U+1B800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1C000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1C800 */ - 71,213,214,215,216,217,218,142,219,220,221,222,223,224,225,226, /* U+1D000 */ -227,227,227,227,228,229,142,142,142,142,142,142,142,142,142,142, /* U+1D800 */ -230,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+1E000 */ -231,232,233,142,142,142,142,142,234,235,142,142,236,237,142,142, /* U+1E800 */ -238,239,240,241,242,243,244,245,244,244,246,244,247,248,249,250, /* U+1F000 */ -251,252,253,254,255,243,243,243,243,243,243,243,243,243,243,256, /* U+1F800 */ + 71,216,217,218,219,220,221,142,222,223,224,225,226,227,228,229, /* U+1D000 */ +230,230,230,230,231,232,142,142,142,142,142,142,142,142,142,142, /* U+1D800 */ +233,142,234,142,142,235,142,142,142,142,142,142,142,142,142,142, /* U+1E000 */ +236,237,238,142,142,142,142,142,239,240,241,142,242,243,142,142, /* U+1E800 */ +244,245,246,247,248,249,250,251,250,250,252,250,253,254,255,256, /* U+1F000 */ +257,258,259,260,261,262,249,249,249,249,249,249,249,249,249,263, /* U+1F800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+20000 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+20800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+21000 */ @@ -1201,18 +1236,18 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+28800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+29000 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+29800 */ - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,257, 98, 98, /* U+2A000 */ + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,264, 98, 98, /* U+2A000 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2A800 */ - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,258, 98, /* U+2B000 */ -259, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2B800 */ + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,265, 98, /* U+2B000 */ +266, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2B800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2C000 */ - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,260, 98, 98, /* U+2C800 */ + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,267, 98, 98, /* U+2C800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2D000 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2D800 */ 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, /* U+2E000 */ - 98, 98, 98, 98, 98, 98, 98,261,142,142,142,142,142,142,142,142, /* U+2E800 */ + 98, 98, 98, 98, 98, 98, 98,268,142,142,142,142,142,142,142,142, /* U+2E800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+2F000 */ - 98, 98, 98, 98,262,142,142,142,142,142,142,142,142,142,142,142, /* U+2F800 */ + 98, 98, 98, 98,269,142,142,142,142,142,142,142,142,142,142,142, /* U+2F800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+30000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+30800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+31000 */ @@ -1565,8 +1600,8 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DE800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DF000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+DF800 */ -263,264,265,266,264,264,264,264,264,264,264,264,264,264,264,264, /* U+E0000 */ -264,264,264,264,264,264,264,264,264,264,264,264,264,264,264,264, /* U+E0800 */ +270,271,272,273,271,271,271,271,271,271,271,271,271,271,271,271, /* U+E0000 */ +271,271,271,271,271,271,271,271,271,271,271,271,271,271,271,271, /* U+E0800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E1000 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E1800 */ 142,142,142,142,142,142,142,142,142,142,142,142,142,142,142,142, /* U+E2000 */ @@ -1628,7 +1663,7 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FE000 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FE800 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+FF000 */ -126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,267, /* U+FF800 */ +126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,274, /* U+FF800 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+100000 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+100800 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+101000 */ @@ -1660,10 +1695,10 @@ const uint16_t PRIV(ucd_stage1)[] = { /* 17408 bytes */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10E000 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10E800 */ 126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126, /* U+10F000 */ -126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,267, /* U+10F800 */ +126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,274, /* U+10F800 */ }; -const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ +const uint16_t PRIV(ucd_stage2)[] = { /* 70400 bytes, block = 128 */ /* block 0 */ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1715,534 +1750,534 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 35, 97, 98, 35, 35, 99, 35, 35, 35, 35, 35, 35, 35,100, 35, 35, /* block 5 */ -101, 35, 35,101, 35, 35, 35,102,101,103,104,104,105, 35, 35, 35, - 35, 35,106, 35, 22, 35, 35, 35, 35, 35, 35, 35, 35,107,108, 35, +101, 35,102,101, 35, 35, 35,103,101,104,105,105,106, 35, 35, 35, + 35, 35,107, 35, 22, 35, 35, 35, 35, 35, 35, 35, 35,108,109, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, -109,109,109,109,109,109,109,109,109,110,110,110,110,110,110,110, -110,110, 15, 15, 15, 15,110,110,110,110,110,110,110,110,110,110, -110,110, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -109,109,109,109,109, 15, 15, 15, 15, 15,111,111,110, 15,110, 15, +110,110,110,110,110,110,110,110,110,111,111,111,111,111,111,111, +111,111, 15, 15, 15, 15,111,111,111,111,111,111,111,111,111,111, +111,111, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +110,110,110,110,110, 15, 15, 15, 15, 15,112,112,111, 15,111, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, /* block 6 */ -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,113,112,112,114,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,115,115,115,115,115,115,115,115,115,115,115,115,115, -116,117,116,117,110,118,116,117,119,119,120,121,121,121, 5,122, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,114,113,113,115,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,116,116,116,116,116,116,116,116,116,116,116,116,116, +117,118,117,118,111,119,117,118,120,120,121,122,122,122, 5,123, /* block 7 */ -119,119,119,119,118, 15,123, 5,124,124,124,119,125,119,126,126, -127,128,129,128,128,130,128,128,131,132,133,128,134,128,128,128, -135,136,119,137,128,128,138,128,128,139,128,128,140,141,141,141, -127,142,143,142,142,144,142,142,145,146,147,142,148,142,142,142, -149,150,151,152,142,142,153,142,142,154,142,142,155,156,156,157, -158,159,160,160,160,161,162,163,116,117,116,117,116,117,116,117, -116,117,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -166,167,168,169,170,171,172,116,117,173,116,117,127,174,174,174, +120,120,120,120,119, 15,124, 5,125,125,125,120,126,120,127,127, +128,129,130,129,129,131,129,129,132,133,134,129,135,129,129,129, +136,137,120,138,129,129,139,129,129,140,129,129,141,142,142,142, +128,143,144,143,143,145,143,143,146,147,148,143,149,143,143,143, +150,151,152,153,143,143,154,143,143,155,143,143,156,157,157,158, +159,160,161,161,161,162,163,164,117,118,117,118,117,118,117,118, +117,118,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +167,168,169,170,171,172,173,117,118,174,117,118,128,175,175,175, /* block 8 */ -175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175, -176,176,177,176,178,176,176,176,176,176,176,176,176,176,179,176, -176,180,181,176,176,176,176,176,176,176,182,176,176,176,176,176, -183,183,184,183,185,183,183,183,183,183,183,183,183,183,186,183, -183,187,188,183,183,183,183,183,183,183,189,183,183,183,183,183, -190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190, -191,192,193,194,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, +176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176, +177,177,178,177,179,177,177,177,177,177,177,177,177,177,180,177, +177,181,182,177,177,177,177,177,177,177,183,177,177,177,177,177, +184,184,185,184,186,184,184,184,184,184,184,184,184,184,187,184, +184,188,189,184,184,184,184,184,184,184,190,184,184,184,184,184, +191,191,191,191,191,191,191,191,191,191,191,191,191,191,191,191, +192,193,194,195,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, /* block 9 */ -191,192,195,196,197,198,198,197,199,199,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -200,191,192,191,192,191,192,191,192,191,192,191,192,191,192,201, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, +192,193,196,197,198,199,199,198,200,200,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +201,192,193,192,193,192,193,192,193,192,193,192,193,192,193,202, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, /* block 10 */ -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -119,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202, -202,202,202,202,202,202,202,202,202,202,202,202,202,202,202,202, -202,202,202,202,202,202,202,119,119,203,204,204,204,204,204,204, -205,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, -206,206,206,206,206,206,206,206,206,206,206,206,206,206,206,206, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +120,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, +203,203,203,203,203,203,203,203,203,203,203,203,203,203,203,203, +203,203,203,203,203,203,203,120,120,204,205,205,205,205,205,205, +206,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207, +207,207,207,207,207,207,207,207,207,207,207,207,207,207,207,207, /* block 11 */ -206,206,206,206,206,206,206,205,205,207,208,119,119,209,209,210, -119,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211, -211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211, -211,211,211,211,211,211,211,211,211,211,211,211,211,211,212,211, -213,211,211,213,211,211,213,211,119,119,119,119,119,119,119,119, -214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214, -214,214,214,214,214,214,214,214,214,214,214,119,119,119,119,214, -214,214,214,213,213,119,119,119,119,119,119,119,119,119,119,119, +207,207,207,207,207,207,207,206,206,208,209,120,120,210,210,211, +120,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212, +212,212,212,212,212,212,212,212,212,212,212,212,212,212,212,212, +212,212,212,212,212,212,212,212,212,212,212,212,212,212,213,212, +214,212,212,214,212,212,214,212,120,120,120,120,120,120,120,120, +215,215,215,215,215,215,215,215,215,215,215,215,215,215,215,215, +215,215,215,215,215,215,215,215,215,215,215,120,120,120,120,215, +215,215,215,214,214,120,120,120,120,120,120,120,120,120,120,120, /* block 12 */ -215,215,215,215,215,216,217,217,217,218,218,219,220,218,221,221, -222,222,222,222,222,222,222,222,222,222,222,220,223,119,218,220, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -225,224,224,224,224,224,224,224,224,224,224,226,226,226,226,226, -226,226,226,226,226,226,222,222,222,222,222,222,222,222,222,222, -227,227,227,227,227,227,227,227,227,227,218,218,218,218,224,224, -226,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, +216,216,216,216,216,217,218,218,218,219,219,220,221,219,222,222, +223,223,223,223,223,223,223,223,223,223,223,221,224,120,219,221, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +226,225,225,225,225,225,225,225,225,225,225,227,227,227,227,227, +227,227,227,227,227,227,223,223,223,223,223,223,223,223,223,223, +228,228,228,228,228,228,228,228,228,228,219,219,219,219,225,225, +227,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 13 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,228,224,222,222,222,222,222,222,222,216,221,222, -222,222,222,222,222,229,229,222,222,221,222,222,222,222,224,224, -230,230,230,230,230,230,230,230,230,230,224,224,224,221,221,224, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,229,225,223,223,223,223,223,223,223,217,222,223, +223,223,223,223,223,230,230,223,223,222,223,223,223,223,225,225, +231,231,231,231,231,231,231,231,231,231,225,225,225,222,222,225, /* block 14 */ -231,231,231,231,231,231,231,231,231,231,231,231,231,231,119,232, -233,234,233,233,233,233,233,233,233,233,233,233,233,233,233,233, -233,233,233,233,233,233,233,233,233,233,233,233,233,233,233,233, +232,232,232,232,232,232,232,232,232,232,232,232,232,232,120,233, +234,235,234,234,234,234,234,234,234,234,234,234,234,234,234,234, 234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, -234,234,234,234,234,234,234,234,234,234,234,119,119,233,233,233, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, +235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, +235,235,235,235,235,235,235,235,235,235,235,120,120,234,234,234, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 15 */ -235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, -235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, -235,235,235,235,235,235,236,236,236,236,236,236,236,236,236,236, -236,235,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -237,237,237,237,237,237,237,237,237,237,238,238,238,238,238,238, -238,238,238,238,238,238,238,238,238,238,238,238,238,238,238,238, -238,238,238,238,238,238,238,238,238,238,238,239,239,239,239,239, -239,239,239,239,240,240,241,242,242,242,240,119,119,239,243,243, +236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236, +236,236,236,236,236,236,236,236,236,236,236,236,236,236,236,236, +236,236,236,236,236,236,237,237,237,237,237,237,237,237,237,237, +237,236,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +238,238,238,238,238,238,238,238,238,238,239,239,239,239,239,239, +239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239, +239,239,239,239,239,239,239,239,239,239,239,240,240,240,240,240, +240,240,240,240,241,241,242,243,243,243,241,120,120,240,244,244, /* block 16 */ -244,244,244,244,244,244,244,244,244,244,244,244,244,244,244,244, -244,244,244,244,244,244,245,245,245,245,246,245,245,245,245,245, -245,245,245,245,246,245,245,245,246,245,245,245,245,245,119,119, -247,247,247,247,247,247,247,247,247,247,247,247,247,247,247,119, -248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248, -248,248,248,248,248,248,248,248,248,249,249,249,119,119,250,119, -233,233,233,233,233,233,233,233,233,233,233,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +245,245,245,245,245,245,245,245,245,245,245,245,245,245,245,245, +245,245,245,245,245,245,246,246,246,246,247,246,246,246,246,246, +246,246,246,246,247,246,246,246,247,246,246,246,246,246,120,120, +248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,120, +249,249,249,249,249,249,249,249,249,249,249,249,249,249,249,249, +249,249,249,249,249,249,249,249,249,250,250,250,120,120,251,120, +234,234,234,234,234,234,234,234,234,234,234,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 17 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,119,224,224,224,224,224,224,224,224,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,222,222,222,222,222,222,222,222,222,222,222,222,222, -222,222,216,222,222,222,222,222,222,222,222,222,222,222,222,222, -222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,120,225,225,225,225,225,225,225,225,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,223,223,223,223,223,223,223,223,223,223,223,223,223, +223,223,217,223,223,223,223,223,223,223,223,223,223,223,223,223, +223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223, /* block 18 */ -251,251,251,252,253,253,253,253,253,253,253,253,253,253,253,253, -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, -253,253,253,253,253,253,253,253,253,253,253,253,253,253,253,253, -253,253,253,253,253,253,253,253,253,253,251,252,251,253,252,252, -252,251,251,251,251,251,251,251,251,252,252,252,252,251,252,252, -253,254,255,251,251,251,251,251,253,253,253,253,253,253,253,253, -253,253,251,251,256,257,258,258,258,258,258,258,258,258,258,258, -259,260,253,253,253,253,253,253,253,253,253,253,253,253,253,253, +252,252,252,253,254,254,254,254,254,254,254,254,254,254,254,254, +254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254, +254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254, +254,254,254,254,254,254,254,254,254,254,252,253,252,254,253,253, +253,252,252,252,252,252,252,252,252,253,253,253,253,252,253,253, +254,255,256,113,113,252,252,252,254,254,254,254,254,254,254,254, +254,254,252,252,257,258,259,259,259,259,259,259,259,259,259,259, +260,261,254,254,254,254,254,254,254,254,254,254,254,254,254,254, /* block 19 */ -261,262,263,263,119,261,261,261,261,261,261,261,261,119,119,261, -261,119,119,261,261,261,261,261,261,261,261,261,261,261,261,261, -261,261,261,261,261,261,261,261,261,119,261,261,261,261,261,261, -261,119,261,119,119,119,261,261,261,261,119,119,262,261,264,263, -263,262,262,262,262,119,119,263,263,119,119,263,263,262,261,119, -119,119,119,119,119,119,119,264,119,119,119,119,261,261,119,261, -261,261,262,262,119,119,265,265,265,265,265,265,265,265,265,265, -261,261,266,266,267,267,267,267,267,267,268,266,261,269,262,119, +262,263,264,264,120,262,262,262,262,262,262,262,262,120,120,262, +262,120,120,262,262,262,262,262,262,262,262,262,262,262,262,262, +262,262,262,262,262,262,262,262,262,120,262,262,262,262,262,262, +262,120,262,120,120,120,262,262,262,262,120,120,263,262,265,264, +264,263,263,263,263,120,120,264,264,120,120,264,264,263,262,120, +120,120,120,120,120,120,120,265,120,120,120,120,262,262,120,262, +262,262,263,263,120,120,266,266,266,266,266,266,266,266,266,266, +262,262,267,267,268,268,268,268,268,268,269,267,262,270,263,120, /* block 20 */ -119,270,270,271,119,272,272,272,272,272,272,119,119,119,119,272, -272,119,119,272,272,272,272,272,272,272,272,272,272,272,272,272, -272,272,272,272,272,272,272,272,272,119,272,272,272,272,272,272, -272,119,272,272,119,272,272,119,272,272,119,119,270,119,271,271, -271,270,270,119,119,119,119,270,270,119,119,270,270,270,119,119, -119,270,119,119,119,119,119,119,119,272,272,272,272,119,272,119, -119,119,119,119,119,119,273,273,273,273,273,273,273,273,273,273, -270,270,272,272,272,270,274,119,119,119,119,119,119,119,119,119, +120,271,271,272,120,273,273,273,273,273,273,120,120,120,120,273, +273,120,120,273,273,273,273,273,273,273,273,273,273,273,273,273, +273,273,273,273,273,273,273,273,273,120,273,273,273,273,273,273, +273,120,273,273,120,273,273,120,273,273,120,120,271,120,272,272, +272,271,271,120,120,120,120,271,271,120,120,271,271,271,120,120, +120,271,120,120,120,120,120,120,120,273,273,273,273,120,273,120, +120,120,120,120,120,120,274,274,274,274,274,274,274,274,274,274, +271,271,273,273,273,271,275,120,120,120,120,120,120,120,120,120, /* block 21 */ -119,275,275,276,119,277,277,277,277,277,277,277,277,277,119,277, -277,277,119,277,277,277,277,277,277,277,277,277,277,277,277,277, -277,277,277,277,277,277,277,277,277,119,277,277,277,277,277,277, -277,119,277,277,119,277,277,277,277,277,119,119,275,277,276,276, -276,275,275,275,275,275,119,275,275,276,119,276,276,275,119,119, -277,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -277,277,275,275,119,119,278,278,278,278,278,278,278,278,278,278, -279,280,119,119,119,119,119,119,119,277,275,275,275,275,275,275, +120,276,276,277,120,278,278,278,278,278,278,278,278,278,120,278, +278,278,120,278,278,278,278,278,278,278,278,278,278,278,278,278, +278,278,278,278,278,278,278,278,278,120,278,278,278,278,278,278, +278,120,278,278,120,278,278,278,278,278,120,120,276,278,277,277, +277,276,276,276,276,276,120,276,276,277,120,277,277,276,120,120, +278,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +278,278,276,276,120,120,279,279,279,279,279,279,279,279,279,279, +280,281,120,120,120,120,120,120,120,278,276,276,276,276,276,276, /* block 22 */ -119,281,282,282,119,283,283,283,283,283,283,283,283,119,119,283, -283,119,119,283,283,283,283,283,283,283,283,283,283,283,283,283, -283,283,283,283,283,283,283,283,283,119,283,283,283,283,283,283, -283,119,283,283,119,283,283,283,283,283,119,119,281,283,284,281, -282,281,281,281,281,119,119,282,282,119,119,282,282,281,119,119, -119,119,119,119,119,119,281,284,119,119,119,119,283,283,119,283, -283,283,281,281,119,119,285,285,285,285,285,285,285,285,285,285, -286,283,287,287,287,287,287,287,119,119,119,119,119,119,119,119, +120,282,283,283,120,284,284,284,284,284,284,284,284,120,120,284, +284,120,120,284,284,284,284,284,284,284,284,284,284,284,284,284, +284,284,284,284,284,284,284,284,284,120,284,284,284,284,284,284, +284,120,284,284,120,284,284,284,284,284,120,120,282,284,285,282, +283,282,282,282,282,120,120,283,283,120,120,283,283,282,120,120, +120,120,120,120,120,120,282,285,120,120,120,120,284,284,120,284, +284,284,282,282,120,120,286,286,286,286,286,286,286,286,286,286, +287,284,288,288,288,288,288,288,120,120,120,120,120,120,120,120, /* block 23 */ -119,119,288,289,119,289,289,289,289,289,289,119,119,119,289,289, -289,119,289,289,289,289,119,119,119,289,289,119,289,119,289,289, -119,119,119,289,289,119,119,119,289,289,289,119,119,119,289,289, -289,289,289,289,289,289,289,289,289,289,119,119,119,119,290,291, -288,291,291,119,119,119,291,291,291,119,291,291,291,288,119,119, -289,119,119,119,119,119,119,290,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,292,292,292,292,292,292,292,292,292,292, -293,293,293,294,295,295,295,295,295,296,295,119,119,119,119,119, +120,120,289,290,120,290,290,290,290,290,290,120,120,120,290,290, +290,120,290,290,290,290,120,120,120,290,290,120,290,120,290,290, +120,120,120,290,290,120,120,120,290,290,290,120,120,120,290,290, +290,290,290,290,290,290,290,290,290,290,120,120,120,120,291,292, +289,292,292,120,120,120,292,292,292,120,292,292,292,289,120,120, +290,120,120,120,120,120,120,291,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,293,293,293,293,293,293,293,293,293,293, +294,294,294,295,296,296,296,296,296,297,296,120,120,120,120,120, /* block 24 */ -297,298,298,298,297,299,299,299,299,299,299,299,299,119,299,299, -299,119,299,299,299,299,299,299,299,299,299,299,299,299,299,299, -299,299,299,299,299,299,299,299,299,119,299,299,299,299,299,299, -299,299,299,299,299,299,299,299,299,299,119,119,119,299,297,297, -297,298,298,298,298,119,297,297,297,119,297,297,297,297,119,119, -119,119,119,119,119,297,297,119,299,299,299,119,119,119,119,119, -299,299,297,297,119,119,300,300,300,300,300,300,300,300,300,300, -119,119,119,119,119,119,119,119,301,301,301,301,301,301,301,302, +298,299,299,299,298,300,300,300,300,300,300,300,300,120,300,300, +300,120,300,300,300,300,300,300,300,300,300,300,300,300,300,300, +300,300,300,300,300,300,300,300,300,120,300,300,300,300,300,300, +300,300,300,300,300,300,300,300,300,300,120,120,120,300,298,298, +298,299,299,299,299,120,298,298,298,120,298,298,298,298,120,120, +120,120,120,120,120,298,298,120,300,300,300,120,120,120,120,120, +300,300,298,298,120,120,301,301,301,301,301,301,301,301,301,301, +120,120,120,120,120,120,120,302,303,303,303,303,303,303,303,304, /* block 25 */ -303,304,305,305,306,303,303,303,303,303,303,303,303,119,303,303, -303,119,303,303,303,303,303,303,303,303,303,303,303,303,303,303, -303,303,303,303,303,303,303,303,303,119,303,303,303,303,303,303, -303,303,303,303,119,303,303,303,303,303,119,119,304,303,305,304, -305,305,307,305,305,119,304,305,305,119,305,305,304,304,119,119, -119,119,119,119,119,307,307,119,119,119,119,119,119,119,303,119, -303,303,304,304,119,119,308,308,308,308,308,308,308,308,308,308, -119,303,303,119,119,119,119,119,119,119,119,119,119,119,119,119, +305,306,307,307,308,305,305,305,305,305,305,305,305,120,305,305, +305,120,305,305,305,305,305,305,305,305,305,305,305,305,305,305, +305,305,305,305,305,305,305,305,305,120,305,305,305,305,305,305, +305,305,305,305,120,305,305,305,305,305,120,120,306,305,307,306, +307,307,309,307,307,120,306,307,307,120,307,307,306,306,120,120, +120,120,120,120,120,309,309,120,120,120,120,120,120,120,305,120, +305,305,306,306,120,120,310,310,310,310,310,310,310,310,310,310, +120,305,305,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 26 */ -309,309,310,310,119,311,311,311,311,311,311,311,311,119,311,311, -311,119,311,311,311,311,311,311,311,311,311,311,311,311,311,311, -311,311,311,311,311,311,311,311,311,311,311,311,311,311,311,311, -311,311,311,311,311,311,311,311,311,311,311,309,309,311,312,310, -310,309,309,309,309,119,310,310,310,119,310,310,310,309,313,314, -119,119,119,119,311,311,311,312,315,315,315,315,315,315,315,311, -311,311,309,309,119,119,316,316,316,316,316,316,316,316,316,316, -315,315,315,315,315,315,315,315,315,314,311,311,311,311,311,311, +311,311,312,312,120,313,313,313,313,313,313,313,313,120,313,313, +313,120,313,313,313,313,313,313,313,313,313,313,313,313,313,313, +313,313,313,313,313,313,313,313,313,313,313,313,313,313,313,313, +313,313,313,313,313,313,313,313,313,313,313,311,311,313,314,312, +312,311,311,311,311,120,312,312,312,120,312,312,312,311,315,316, +120,120,120,120,313,313,313,314,317,317,317,317,317,317,317,313, +313,313,311,311,120,120,318,318,318,318,318,318,318,318,318,318, +317,317,317,317,317,317,317,317,317,316,313,313,313,313,313,313, /* block 27 */ -119,119,317,317,119,318,318,318,318,318,318,318,318,318,318,318, -318,318,318,318,318,318,318,119,119,119,318,318,318,318,318,318, -318,318,318,318,318,318,318,318,318,318,318,318,318,318,318,318, -318,318,119,318,318,318,318,318,318,318,318,318,119,318,119,119, -318,318,318,318,318,318,318,119,119,119,319,119,119,119,119,320, -317,317,319,319,319,119,319,119,317,317,317,317,317,317,317,320, -119,119,119,119,119,119,321,321,321,321,321,321,321,321,321,321, -119,119,317,317,322,119,119,119,119,119,119,119,119,119,119,119, +120,120,319,319,120,320,320,320,320,320,320,320,320,320,320,320, +320,320,320,320,320,320,320,120,120,120,320,320,320,320,320,320, +320,320,320,320,320,320,320,320,320,320,320,320,320,320,320,320, +320,320,120,320,320,320,320,320,320,320,320,320,120,320,120,120, +320,320,320,320,320,320,320,120,120,120,321,120,120,120,120,322, +319,319,321,321,321,120,321,120,319,319,319,319,319,319,319,322, +120,120,120,120,120,120,323,323,323,323,323,323,323,323,323,323, +120,120,319,319,324,120,120,120,120,120,120,120,120,120,120,120, /* block 28 */ -119,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323, -323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323, -323,323,323,323,323,323,323,323,323,323,323,323,323,323,323,323, -323,324,323,325,324,324,324,324,324,324,324,119,119,119,119, 6, -323,323,323,323,323,323,326,324,324,324,324,324,324,324,324,327, -328,328,328,328,328,328,328,328,328,328,327,327,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325, +325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325, +325,325,325,325,325,325,325,325,325,325,325,325,325,325,325,325, +325,326,325,327,326,326,326,326,326,326,326,120,120,120,120, 6, +325,325,325,325,325,325,328,326,326,326,326,326,326,326,326,329, +330,330,330,330,330,330,330,330,330,330,329,329,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 29 */ -119,329,329,119,329,119,119,329,329,119,329,119,119,329,119,119, -119,119,119,119,329,329,329,329,119,329,329,329,329,329,329,329, -119,329,329,329,119,329,119,329,119,119,329,329,119,329,329,329, -329,330,329,331,330,330,330,330,330,330,119,330,330,329,119,119, -329,329,329,329,329,119,332,119,330,330,330,330,330,330,119,119, -333,333,333,333,333,333,333,333,333,333,119,119,329,329,329,329, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,331,331,120,331,120,331,331,331,331,331,120,331,331,331,331, +331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331, +331,331,331,331,120,331,120,331,331,331,331,331,331,331,331,331, +331,332,331,333,332,332,332,332,332,332,332,332,332,331,120,120, +331,331,331,331,331,120,334,120,332,332,332,332,332,332,120,120, +335,335,335,335,335,335,335,335,335,335,120,120,331,331,331,331, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 30 */ -334,335,335,335,336,336,336,336,336,336,336,336,336,336,336,336, -336,336,336,335,336,335,335,335,337,337,335,335,335,335,335,335, -338,338,338,338,338,338,338,338,338,338,339,339,339,339,339,339, -339,339,339,339,335,337,335,337,335,337,340,341,340,341,342,342, -334,334,334,334,334,334,334,334,119,334,334,334,334,334,334,334, -334,334,334,334,334,334,334,334,334,334,334,334,334,334,334,334, -334,334,334,334,334,334,334,334,334,334,334,334,334,119,119,119, -119,337,337,337,337,337,337,337,337,337,337,337,337,337,337,342, +336,337,337,337,338,338,338,338,338,338,338,338,338,338,338,338, +338,338,338,337,338,337,337,337,339,339,337,337,337,337,337,337, +340,340,340,340,340,340,340,340,340,340,341,341,341,341,341,341, +341,341,341,341,337,339,337,339,337,339,342,343,342,343,344,344, +336,336,336,336,336,336,336,336,120,336,336,336,336,336,336,336, +336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336, +336,336,336,336,336,336,336,336,336,336,336,336,336,120,120,120, +120,339,339,339,339,339,339,339,339,339,339,339,339,339,339,344, /* block 31 */ -337,337,337,337,337,336,337,337,334,334,334,334,334,337,337,337, -337,337,337,337,337,337,337,337,119,337,337,337,337,337,337,337, -337,337,337,337,337,337,337,337,337,337,337,337,337,337,337,337, -337,337,337,337,337,337,337,337,337,337,337,337,337,119,335,335, -335,335,335,335,335,335,337,335,335,335,335,335,335,119,335,335, -336,336,336,336,336, 20, 20, 20, 20,336,336,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +339,339,339,339,339,338,339,339,336,336,336,336,336,339,339,339, +339,339,339,339,339,339,339,339,120,339,339,339,339,339,339,339, +339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339, +339,339,339,339,339,339,339,339,339,339,339,339,339,120,337,337, +337,337,337,337,337,337,339,337,337,337,337,337,337,120,337,337, +338,338,338,338,338, 20, 20, 20, 20,338,338,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 32 */ -343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343, -343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343, -343,343,343,343,343,343,343,343,343,343,343,344,344,345,345,345, -345,346,345,345,345,345,345,345,344,345,345,346,346,345,345,343, -347,347,347,347,347,347,347,347,347,347,348,348,348,348,348,348, -343,343,343,343,343,343,346,346,345,345,343,343,343,343,345,345, -345,343,344,344,344,343,343,344,344,344,344,344,344,344,343,343, -343,345,345,345,345,343,343,343,343,343,343,343,343,343,343,343, +345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345, +345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345, +345,345,345,345,345,345,345,345,345,345,345,346,346,347,347,347, +347,348,347,347,347,347,347,347,346,347,347,348,348,347,347,345, +349,349,349,349,349,349,349,349,349,349,350,350,350,350,350,350, +345,345,345,345,345,345,348,348,347,347,345,345,345,345,347,347, +347,345,346,346,346,345,345,346,346,346,346,346,346,346,345,345, +345,347,347,347,347,345,345,345,345,345,345,345,345,345,345,345, /* block 33 */ -343,343,345,344,346,345,345,344,344,344,344,344,344,345,343,344, -349,349,349,349,349,349,349,349,349,349,344,344,344,345,350,350, -351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351, -351,351,351,351,351,351,351,351,351,351,351,351,351,351,351,351, -351,351,351,351,351,351,119,351,119,119,119,119,119,351,119,119, -352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352, -352,352,352,352,352,352,352,352,352,352,352,352,352,352,352,352, -352,352,352,352,352,352,352,352,352,352,352,353,354,352,352,352, +345,345,347,346,348,347,347,346,346,346,346,346,346,347,345,346, +351,351,351,351,351,351,351,351,351,351,346,346,346,347,352,352, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,353,353,353,353,353,353,353,353,353,353, +353,353,353,353,353,353,120,353,120,120,120,120,120,353,120,120, +354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354, +354,354,354,354,354,354,354,354,354,354,354,354,354,354,354,354, +354,354,354,354,354,354,354,354,354,354,354,355,356,354,354,354, /* block 34 */ -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356, -356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356, - -/* block 35 */ -356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356, -356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356, -356,356,356,356,356,356,356,356,357,357,357,357,357,357,357,357, 357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, - -/* block 36 */ -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, +357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, 358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, 358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,119,358,358,358,358,119,119, -358,358,358,358,358,358,358,119,358,119,358,358,358,358,119,119, + +/* block 35 */ 358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, 358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, +358,358,358,358,358,358,358,358,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, + +/* block 36 */ +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,120,360,360,360,360,120,120, +360,360,360,360,360,360,360,120,360,120,360,360,360,360,120,120, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, /* block 37 */ -358,358,358,358,358,358,358,358,358,119,358,358,358,358,119,119, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,119, -358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, +360,360,360,360,360,360,360,360,360,120,360,360,360,360,120,120, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,120, +360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, /* block 38 */ -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,119,358,358,358,358,119,119,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,358,358,358,358,119,119,359,359,359, -360,360,360,360,360,360,360,360,360,361,361,361,361,361,361,361, -361,361,361,361,361,361,361,361,361,361,361,361,361,119,119,119, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,120,360,360,360,360,120,120,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,360,360,360,360,120,120,361,361,361, +362,362,362,362,362,362,362,362,362,363,363,363,363,363,363,363, +363,363,363,363,363,363,363,363,363,363,363,363,363,120,120,120, /* block 39 */ -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -362,362,362,362,362,362,362,362,362,362,119,119,119,119,119,119, -363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363, -363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363, -363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363, -363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363, -363,363,363,363,363,363,363,363,363,363,363,363,363,363,363,363, -364,364,364,364,364,364,119,119,365,365,365,365,365,365,119,119, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +364,364,364,364,364,364,364,364,364,364,120,120,120,120,120,120, +365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365, +365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365, +365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365, +365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365, +365,365,365,365,365,365,365,365,365,365,365,365,365,365,365,365, +366,366,366,366,366,366,120,120,367,367,367,367,367,367,120,120, /* block 40 */ -366,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, +368,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, /* block 41 */ -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, /* block 42 */ -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,368,368,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,370,371,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, /* block 43 */ -369,370,370,370,370,370,370,370,370,370,370,370,370,370,370,370, -370,370,370,370,370,370,370,370,370,370,370,371,372,119,119,119, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, -373,373,373,373,373,373,373,373,373,373,373, 5, 5, 5,374,374, -374,373,373,373,373,373,373,373,373,119,119,119,119,119,119,119, +372,373,373,373,373,373,373,373,373,373,373,373,373,373,373,373, +373,373,373,373,373,373,373,373,373,373,373,374,375,120,120,120, +376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, +376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, +376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, +376,376,376,376,376,376,376,376,376,376,376,376,376,376,376,376, +376,376,376,376,376,376,376,376,376,376,376, 5, 5, 5,377,377, +377,376,376,376,376,376,376,376,376,120,120,120,120,120,120,120, /* block 44 */ -375,375,375,375,375,375,375,375,375,375,375,375,375,119,375,375, -375,375,376,376,376,119,119,119,119,119,119,119,119,119,119,119, -377,377,377,377,377,377,377,377,377,377,377,377,377,377,377,377, -377,377,378,378,378,379,379,119,119,119,119,119,119,119,119,119, +378,378,378,378,378,378,378,378,378,378,378,378,378,120,378,378, +378,378,379,379,379,120,120,120,120,120,120,120,120,120,120,120, 380,380,380,380,380,380,380,380,380,380,380,380,380,380,380,380, -380,380,381,381,119,119,119,119,119,119,119,119,119,119,119,119, -382,382,382,382,382,382,382,382,382,382,382,382,382,119,382,382, -382,119,383,383,119,119,119,119,119,119,119,119,119,119,119,119, +380,380,381,381,381,382,382,120,120,120,120,120,120,120,120,120, +383,383,383,383,383,383,383,383,383,383,383,383,383,383,383,383, +383,383,384,384,120,120,120,120,120,120,120,120,120,120,120,120, +385,385,385,385,385,385,385,385,385,385,385,385,385,120,385,385, +385,120,386,386,120,120,120,120,120,120,120,120,120,120,120,120, /* block 45 */ -384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384, -384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384, -384,384,384,384,384,384,384,384,384,384,384,384,384,384,384,384, -384,384,384,384,385,385,386,385,385,385,385,385,385,385,386,386, -386,386,386,386,386,386,385,386,386,385,385,385,385,385,385,385, -385,385,385,385,387,387,387,388,387,387,387,389,384,385,119,119, -390,390,390,390,390,390,390,390,390,390,119,119,119,119,119,119, -391,391,391,391,391,391,391,391,391,391,119,119,119,119,119,119, +387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387, +387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387, +387,387,387,387,387,387,387,387,387,387,387,387,387,387,387,387, +387,387,387,387,388,388,389,388,388,388,388,388,388,388,389,389, +389,389,389,389,389,389,388,389,389,388,388,388,388,388,388,388, +388,388,388,388,390,390,390,391,390,390,390,392,387,388,120,120, +393,393,393,393,393,393,393,393,393,393,120,120,120,120,120,120, +394,394,394,394,394,394,394,394,394,394,120,120,120,120,120,120, /* block 46 */ -392,392,393,393,392,393,394,392,392,392,392,395,395,395,396,119, -397,397,397,397,397,397,397,397,397,397,119,119,119,119,119,119, -398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,399,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,119,119,119,119,119,119,119, +395,395,396,396,395,396,397,395,395,395,395,398,398,398,399,120, +400,400,400,400,400,400,400,400,400,400,120,120,120,120,120,120, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,402,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,120,120,120,120,120,120,120, /* block 47 */ -398,398,398,398,398,395,395,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,398,398,398,398,398,398,398, -398,398,398,398,398,398,398,398,398,395,398,119,119,119,119,119, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,367,367,367,367,367,367,367,367,367,367, -367,367,367,367,367,367,119,119,119,119,119,119,119,119,119,119, +401,401,401,401,401,398,398,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401, +401,401,401,401,401,401,401,401,401,398,401,120,120,120,120,120, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,369,369,369,369,369,369,369,369,369,369, +369,369,369,369,369,369,120,120,120,120,120,120,120,120,120,120, /* block 48 */ -400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,400, -400,400,400,400,400,400,400,400,400,400,400,400,400,400,400,119, -401,401,401,402,402,402,402,401,401,402,402,402,119,119,119,119, -402,402,401,402,402,402,402,402,402,401,401,401,119,119,119,119, -403,119,119,119,404,404,405,405,405,405,405,405,405,405,405,405, -406,406,406,406,406,406,406,406,406,406,406,406,406,406,406,406, -406,406,406,406,406,406,406,406,406,406,406,406,406,406,119,119, -406,406,406,406,406,119,119,119,119,119,119,119,119,119,119,119, +403,403,403,403,403,403,403,403,403,403,403,403,403,403,403,403, +403,403,403,403,403,403,403,403,403,403,403,403,403,403,403,120, +404,404,404,405,405,405,405,404,404,405,405,405,120,120,120,120, +405,405,404,405,405,405,405,405,405,404,404,404,120,120,120,120, +406,120,120,120,407,407,408,408,408,408,408,408,408,408,408,408, +409,409,409,409,409,409,409,409,409,409,409,409,409,409,409,409, +409,409,409,409,409,409,409,409,409,409,409,409,409,409,120,120, +409,409,409,409,409,120,120,120,120,120,120,120,120,120,120,120, /* block 49 */ -407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407, -407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407, -407,407,407,407,407,407,407,407,407,407,407,407,119,119,119,119, -407,407,407,407,407,407,407,407,407,407,407,407,407,407,407,407, -407,407,407,407,407,407,407,407,407,407,119,119,119,119,119,119, -408,408,408,408,408,408,408,408,408,408,409,119,119,119,410,410, -411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,411, -411,411,411,411,411,411,411,411,411,411,411,411,411,411,411,411, +410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410, +410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410, +410,410,410,410,410,410,410,410,410,410,410,410,120,120,120,120, +410,410,410,410,410,410,410,410,410,410,410,410,410,410,410,410, +410,410,410,410,410,410,410,410,410,410,120,120,120,120,120,120, +411,411,411,411,411,411,411,411,411,411,412,120,120,120,413,413, +414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414, +414,414,414,414,414,414,414,414,414,414,414,414,414,414,414,414, /* block 50 */ -412,412,412,412,412,412,412,412,412,412,412,412,412,412,412,412, -412,412,412,412,412,412,412,413,413,414,414,413,119,119,415,415, -416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416, -416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416, -416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416, -416,416,416,416,416,417,418,417,418,418,418,418,418,418,418,119, -418,419,418,419,419,418,418,418,418,418,418,418,418,417,417,417, -417,417,417,418,418,418,418,418,418,418,418,418,418,119,119,418, +415,415,415,415,415,415,415,415,415,415,415,415,415,415,415,415, +415,415,415,415,415,415,415,416,416,417,417,416,120,120,418,418, +419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419, +419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419, +419,419,419,419,419,419,419,419,419,419,419,419,419,419,419,419, +419,419,419,419,419,420,421,420,421,421,421,421,421,421,421,120, +421,422,421,422,422,421,421,421,421,421,421,421,421,420,420,420, +420,420,420,421,421,421,421,421,421,421,421,421,421,120,120,421, /* block 51 */ -420,420,420,420,420,420,420,420,420,420,119,119,119,119,119,119, -420,420,420,420,420,420,420,420,420,420,119,119,119,119,119,119, -421,421,421,421,421,421,421,422,421,421,421,421,421,421,119,119, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,423,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +423,423,423,423,423,423,423,423,423,423,120,120,120,120,120,120, +423,423,423,423,423,423,423,423,423,423,120,120,120,120,120,120, +424,424,424,424,424,424,424,425,424,424,424,424,424,424,120,120, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,426,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 52 */ -424,424,424,424,425,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,426,426,426,426,426,426,426,426,426,426,426,426, -426,426,426,426,424,425,424,424,424,424,424,425,424,425,425,425, -425,425,424,425,425,426,426,426,426,426,426,426,119,119,119,119, -427,427,427,427,427,427,427,427,427,427,428,428,428,428,428,428, -428,429,429,429,429,429,429,429,429,429,429,424,424,424,424,424, -424,424,424,424,429,429,429,429,429,429,429,429,429,119,119,119, +427,427,427,427,428,429,429,429,429,429,429,429,429,429,429,429, +429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, +429,429,429,429,429,429,429,429,429,429,429,429,429,429,429,429, +429,429,429,429,427,430,427,427,427,427,427,428,427,428,428,428, +428,428,427,428,428,429,429,429,429,429,429,429,120,120,120,120, +431,431,431,431,431,431,431,431,431,431,432,432,432,432,432,432, +432,433,433,433,433,433,433,433,433,433,433,427,427,427,427,427, +427,427,427,427,433,433,433,433,433,433,433,433,433,120,120,120, /* block 53 */ -430,430,431,432,432,432,432,432,432,432,432,432,432,432,432,432, -432,432,432,432,432,432,432,432,432,432,432,432,432,432,432,432, -432,431,430,430,430,430,431,431,430,430,431,430,430,430,432,432, -433,433,433,433,433,433,433,433,433,433,432,432,432,432,432,432, -434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434, -434,434,434,434,434,434,434,434,434,434,434,434,434,434,434,434, -434,434,434,434,434,434,435,436,435,435,436,436,436,435,436,435, -435,435,436,436,119,119,119,119,119,119,119,119,437,437,437,437, - -/* block 54 */ +434,434,435,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,436,436,436,436,436,436,436,436,436,436,436,436,436,436,436, +436,435,434,434,434,434,435,435,434,434,435,434,434,434,436,436, +437,437,437,437,437,437,437,437,437,437,436,436,436,436,436,436, 438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, 438,438,438,438,438,438,438,438,438,438,438,438,438,438,438,438, -438,438,438,438,439,439,439,439,439,439,439,439,440,440,440,440, -440,440,440,440,439,439,440,440,119,119,119,441,441,441,441,441, -442,442,442,442,442,442,442,442,442,442,119,119,119,438,438,438, -443,443,443,443,443,443,443,443,443,443,444,444,444,444,444,444, -444,444,444,444,444,444,444,444,444,444,444,444,444,444,444,444, -444,444,444,444,444,444,444,444,445,445,445,445,445,445,446,446, +438,438,438,438,438,438,439,440,439,439,440,440,440,439,440,439, +439,439,440,440,120,120,120,120,120,120,120,120,441,441,441,441, + +/* block 54 */ +442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442, +442,442,442,442,442,442,442,442,442,442,442,442,442,442,442,442, +442,442,442,442,443,443,443,443,443,443,443,443,444,444,444,444, +444,444,444,444,443,443,444,444,120,120,120,445,445,445,445,445, +446,446,446,446,446,446,446,446,446,446,120,120,120,442,442,442, +447,447,447,447,447,447,447,447,447,447,448,448,448,448,448,448, +448,448,448,448,448,448,448,448,448,448,448,448,448,448,448,448, +448,448,448,448,448,448,448,448,449,449,449,449,449,449,450,450, /* block 55 */ -447,448,449,450,451,452,453,454,455,119,119,119,119,119,119,119, -456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,456, -456,456,456,456,456,456,456,456,456,456,456,456,456,456,456,456, -456,456,456,456,456,456,456,456,456,456,456,119,119,456,456,456, -457,457,457,457,457,457,457,457,119,119,119,119,119,119,119,119, -458,459,458,460,459,461,461,462,461,462,463,459,462,462,459,459, -462,464,459,459,459,459,459,459,459,465,466,465,465,461,465,465, -465,465,467,467,468,466,466,469,470,470,119,119,119,119,119,119, +451,452,453,454,455,456,457,458,459,120,120,120,120,120,120,120, +460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,460, +460,460,460,460,460,460,460,460,460,460,460,460,460,460,460,460, +460,460,460,460,460,460,460,460,460,460,460,120,120,460,460,460, +461,461,461,461,461,461,461,461,120,120,120,120,120,120,120,120, +462,463,462,464,463,465,465,466,465,466,467,463,466,466,463,463, +466,468,463,463,463,463,463,463,463,469,470,471,471,465,471,471, +471,471,472,473,474,470,470,475,476,476,477,120,120,120,120,120, /* block 56 */ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35,127,127,127,127,127,471,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,120,120,120, -120,120,109,109,109,109,120,120,120,120,120, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35,472,473, 35, 35, 35,474, 35, 35, + 35, 35, 35, 35, 35, 35,128,128,128,128,128,478,110,110,110,110, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, +110,110,110,110,110,110,110,110,110,110,110,110,110,121,121,121, +121,121,110,110,110,110,121,121,121,121,121, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35,479,480, 35, 35, 35,481, 35, 35, /* block 57 */ - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109, -109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,120, -113,113,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,119,112,112,112,112,112, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,482, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,110,110,110,110,110, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110, +110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,121, +114,114,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,120,113,113,113,113,113, /* block 58 */ 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, @@ -2251,12 +2286,12 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, -475,476, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, +483,484, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, /* block 59 */ 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, - 32, 33, 32, 33, 32, 33, 35, 35, 35, 35, 35,477, 35, 35,478, 35, + 32, 33, 32, 33, 32, 33, 35, 35, 35, 35, 35,485, 35, 35,486, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, @@ -2265,58 +2300,58 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, /* block 60 */ -479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480, -479,479,479,479,479,479,119,119,480,480,480,480,480,480,119,119, -479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480, -479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480, -479,479,479,479,479,479,119,119,480,480,480,480,480,480,119,119, -127,479,127,479,127,479,127,479,119,480,119,480,119,480,119,480, -479,479,479,479,479,479,479,479,480,480,480,480,480,480,480,480, -481,481,482,482,482,482,483,483,484,484,485,485,486,486,119,119, +487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488, +487,487,487,487,487,487,120,120,488,488,488,488,488,488,120,120, +487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488, +487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488, +487,487,487,487,487,487,120,120,488,488,488,488,488,488,120,120, +128,487,128,487,128,487,128,487,120,488,120,488,120,488,120,488, +487,487,487,487,487,487,487,487,488,488,488,488,488,488,488,488, +489,489,490,490,490,490,491,491,492,492,493,493,494,494,120,120, /* block 61 */ -479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487, -479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487, -479,479,479,479,479,479,479,479,487,487,487,487,487,487,487,487, -479,479,127,488,127,119,127,127,480,480,489,489,490,118,491,118, -118,118,127,488,127,119,127,127,492,492,492,492,490,118,118,118, -479,479,127,127,119,119,127,127,480,480,493,493,119,118,118,118, -479,479,127,127,127,168,127,127,480,480,494,494,173,118,118,118, -119,119,127,488,127,119,127,127,495,495,496,496,490,118,118,119, +487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495, +487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495, +487,487,487,487,487,487,487,487,495,495,495,495,495,495,495,495, +487,487,128,496,128,120,128,128,488,488,497,497,498,119,499,119, +119,119,128,496,128,120,128,128,500,500,500,500,498,119,119,119, +487,487,128,128,120,120,128,128,488,488,501,501,120,119,119,119, +487,487,128,128,128,169,128,128,488,488,502,502,174,119,119,119, +120,120,128,496,128,120,128,128,503,503,504,504,498,119,119,120, /* block 62 */ - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 24,497,498, 24, 24, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 24,505,506, 24, 24, 10, 10, 10, 10, 10, 10, 5, 5, 23, 27, 7, 23, 23, 27, 7, 23, - 5, 5, 5, 5, 5, 5, 5, 5,499,500, 24, 24, 24, 24, 24, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 27, 5,501, 5, 5, 16, - 16, 5, 5, 5, 9, 7, 8, 5, 5,501, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5,507,508, 24, 24, 24, 24, 24,509, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 23, 27, 5,510, 5, 5, 16, + 16, 5, 5, 5, 9, 7, 8, 5, 5,510, 5, 5, 5, 5, 5, 5, 5, 5, 9, 5, 16, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, - 24, 24, 24, 24, 24,502, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 25,109,119,119, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,109, + 24, 24, 24, 24, 24,511, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, + 25,110,120,120, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,110, /* block 63 */ - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,119, -109,109,109,109,109,109,109,109,109,109,109,109,109,119,119,119, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 9, 9, 9, 7, 8,120, +110,110,110,110,110,110,110,110,110,110,110,110,110,120,120,120, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -112,112,112,112,112,112,112,112,112,112,112,112,112,423,423,423, -423,112,423,423,423,112,112,112,112,112,112,112,112,112,112,112, -503,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +113,113,113,113,113,113,113,113,113,113,113,113,113,426,426,426, +426,113,426,426,426,113,113,113,113,113,113,113,113,113,113,113, +512,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 64 */ - 20, 20,504, 20, 20, 20, 20,504, 20, 20,505,504,504,504,505,505, -504,504,504,505, 20,504, 20, 20, 9,504,504,504,504,504, 20, 20, - 20, 20, 21, 20,504, 20,506, 20,504, 20,507,508,504,504, 20,505, -504,504,509,504,505,510,510,510,510,511, 20, 20,505,505,504,504, - 9, 9, 9, 9, 9,504,505,505,505,505, 20, 9, 20, 20,512, 20, + 20, 20,513, 20, 20, 20, 20,513, 20, 20,514,513,513,513,514,514, +513,513,513,514, 20,513, 20, 20, 9,513,513,513,513,513, 20, 20, + 20, 20, 21, 20,513, 20,515, 20,513, 20,516,517,513,513, 20,514, +513,513,518,513,514,519,519,519,519,520, 20, 20,514,514,513,513, + 9, 9, 9, 9, 9,513,514,514,514,514, 20, 9, 20, 20,521, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, -514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522, +523,523,523,523,523,523,523,523,523,523,523,523,523,523,523,523, /* block 65 */ -515,515,515, 32, 33,515,515,515,515, 25, 20, 20,119,119,119,119, - 9, 9, 9, 9,516, 21, 21, 21, 21, 21, 9, 9, 20, 20, 20, 20, +524,524,524, 32, 33,524,524,524,524, 25, 20, 20,120,120,120,120, + 9, 9, 9, 9,525, 21, 21, 21, 21, 21, 9, 9, 20, 20, 20, 20, 9, 20, 20, 9, 20, 20, 9, 20, 20, 21, 21, 20, 20, 20, 9, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, @@ -2357,10 +2392,10 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ /* block 69 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, + 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, @@ -2368,10 +2403,10 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20,517,517,517,517,517,517,517,517,517,517, -517,517,518,517,517,517,517,517,517,517,517,517,517,517,517,517, -519,519,519,519,519,519,519,519,519,519,519,519,519,519,519,519, -519,519,519,519,519,519,519,519,519,519, 25, 25, 25, 25, 25, 25, + 20, 20, 20, 20, 20, 20,526,526,526,526,526,526,526,526,526,526, +526,526,527,526,526,526,526,526,526,526,526,526,526,526,526,526, +528,528,528,528,528,528,528,528,528,528,528,528,528,528,528,528, +528,528,528,528,528,528,528,528,528,528, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, /* block 71 */ @@ -2392,7 +2427,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 21, 9, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, 9,516,516,516,516, 9, + 20, 20, 20, 20, 20, 20, 20, 20, 9, 9, 9,525,525,525,525, 9, /* block 73 */ 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -2401,7 +2436,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,516, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,525, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, /* block 74 */ @@ -2435,20 +2470,20 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, /* block 77 */ -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, -520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, +529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529, /* block 78 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9,516,516, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9,525,525, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, @@ -2472,167 +2507,167 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 9, 9, 9, 9, 9, 20, 20, 9, 9, 9, 9, 9, 9, 20, 20, 20, 21, 20, 20, 20, 20, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* block 81 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20,119, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119, /* block 82 */ -521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521, -521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521, -521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,119, -522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522, -522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,522, -522,522,522,522,522,522,522,522,522,522,522,522,522,522,522,119, - 32, 33,523,524,525,526,527, 32, 33, 32, 33, 32, 33,528,529,530, -531, 35, 32, 33, 35, 32, 33, 35, 35, 35, 35, 35,109,109,532,532, +530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530, +530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,530, +530,530,530,530,530,530,530,530,530,530,530,530,530,530,530,120, +531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,531, +531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,531, +531,531,531,531,531,531,531,531,531,531,531,531,531,531,531,120, + 32, 33,532,533,534,535,536, 32, 33, 32, 33, 32, 33,537,538,539, +540, 35, 32, 33, 35, 32, 33, 35, 35, 35, 35, 35,110,110,541,541, /* block 83 */ -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,164,165,164,165,164,165,164,165,164,165,164,165, -164,165,164,165,533,534,534,534,534,534,534,164,165,164,165,535, -535,535,164,165,119,119,119,119,119,536,536,536,536,537,536,536, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,165,166,165,166,165,166,165,166,165,166,165,166, +165,166,165,166,542,543,543,543,543,543,543,165,166,165,166,544, +544,544,165,166,120,120,120,120,120,545,545,545,545,546,545,545, /* block 84 */ -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,538,538,538,538,538,538,538,538,538,538, -538,538,538,538,538,538,119,538,119,119,119,119,119,538,119,119, -539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, -539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, -539,539,539,539,539,539,539,539,539,539,539,539,539,539,539,539, -539,539,539,539,539,539,539,539,119,119,119,119,119,119,119,540, -541,119,119,119,119,119,119,119,119,119,119,119,119,119,119,542, +547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547, +547,547,547,547,547,547,547,547,547,547,547,547,547,547,547,547, +547,547,547,547,547,547,120,547,120,120,120,120,120,547,120,120, +548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548, +548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548, +548,548,548,548,548,548,548,548,548,548,548,548,548,548,548,548, +548,548,548,548,548,548,548,548,120,120,120,120,120,120,120,549, +550,120,120,120,120,120,120,120,120,120,120,120,120,120,120,551, /* block 85 */ -358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, -358,358,358,358,358,358,358,119,119,119,119,119,119,119,119,119, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119, -543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, -543,543,543,543,543,543,543,543,543,543,543,543,543,543,543,543, +360,360,360,360,360,360,360,360,360,360,360,360,360,360,360,360, +360,360,360,360,360,360,360,120,120,120,120,120,120,120,120,120, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, +552,552,552,552,552,552,552,552,552,552,552,552,552,552,552,552, /* block 86 */ 5, 5, 23, 27, 23, 27, 5, 5, 5, 23, 27, 5, 23, 27, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 5, 5, 10, 5, 23, 27, 5, 5, - 23, 27, 7, 8, 7, 8, 7, 8, 7, 8, 5, 5, 5, 5, 5,110, + 23, 27, 7, 8, 7, 8, 7, 8, 7, 8, 5, 5, 5, 5, 5,111, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 5, 5, 5, 5, - 10, 5, 7,544, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, + 10, 5, 7,553, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 87 */ -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,119,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,119,119,119,119,119,119,119,119,119,119,119,119, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,120,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,120,120,120,120,120,120,120,120,120,120,120,120, /* block 88 */ -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, /* block 89 */ -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,545,545,545,545,545,545,545,545,545,545, -545,545,545,545,545,545,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,554,554,554,554,554,554,554,554,554,554, +554,554,554,554,554,554,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120, /* block 90 */ - 4,546,546,547, 20,548,549,550,551,552,551,552,551,552,551,552, -551,552, 20,553,551,552,551,552,551,552,551,552,554,555,556,556, - 20,550,550,550,550,550,550,550,550,550,557,557,557,557,558,558, -559,560,560,560,560,560, 20,553,550,550,550,548,561,562,563,563, -119,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, + 4,555,555,556, 20,557,558,559,560,561,560,561,560,561,560,561, +560,561, 20,562,560,561,560,561,560,561,560,561,563,564,565,565, + 20,559,559,559,559,559,559,559,559,559,566,566,566,566,567,567, +568,569,569,569,569,569, 20,562,559,559,559,557,570,571,572,572, +120,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, /* block 91 */ -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,119,119,565,565,566,566,567,567,564, -568,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,546,560,570,570,569, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,120,120,574,574,575,575,576,576,573, +577,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,555,569,579,579,578, /* block 92 */ -119,119,119,119,119,571,571,571,571,571,571,571,571,571,571,571, -571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571, -571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571, -119,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +120,120,120,120,120,580,580,580,580,580,580,580,580,580,580,580, +580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, +580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, +120,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, /* block 93 */ -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,119, -563,563,573,573,573,573,563,563,563,563,563,563,563,563,563,563, -571,571,571,571,571,571,571,571,571,571,571,571,571,571,571,571, -571,571,571,571,571,571,571,571,571,571,571,119,119,119,119,119, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563,563,563,563,119,119,119,119,119,119,119,119,119,119,119,119, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,120, +572,572,582,582,582,582,572,572,572,572,572,572,572,572,572,572, +580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, +580,580,580,580,580,580,580,580,580,580,580,120,120,120,120,120, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572,572,572,572,120,120,120,120,120,120,120,120,120,120,120,120, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, /* block 94 */ -574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, -574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,119, -573,573,573,573,573,573,573,573,573,573,563,563,563,563,563,563, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563,563,563,563,563,563,563,563, 25, 25, 25, 25, 25, 25, 25, 25, +583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583, +583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,120, +582,582,582,582,582,582,582,582,582,582,572,572,572,572,572,572, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572,572,572,572,572,572,572,572, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -574,574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, -574,574,574,574,574,574,574,574,574,574,574,574,574,574,574, 20, +583,583,583,583,583,583,583,583,583,583,583,583,583,583,583,583, +583,583,583,583,583,583,583,583,583,583,583,583,583,583,583, 20, /* block 95 */ -573,573,573,573,573,573,573,573,573,573,563,563,563,563,563,563, -563,563,563,563,563,563,563,575,563,575,563,563,563,563,563,563, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -563,563,563,563,563,563,563,563,563,563,563,563, 20, 20, 20, 20, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,119, +582,582,582,582,582,582,582,582,582,582,572,572,572,572,572,572, +572,572,572,572,572,572,572,584,572,584,572,572,572,572,572,572, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +572,572,572,572,572,572,572,572,572,572,572,572, 20, 20, 20, 20, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,572, /* block 96 */ -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,576,576,576,576,576,576,576,576, -576,576,576,576,576,576,576,576,563,563,563,563,563,563,563,563, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,563,563,563,563,563, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,585,585,585,585,585,585,585,585, +585,585,585,585,585,585,585,585,572,572,572,572,572,572,572,572, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,572,572,572,572,572, /* block 97 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, @@ -2641,1160 +2676,1190 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, -563,563,563,563,563,563,563,563,563,563,563,563,563,563,563, 20, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, +572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, 20, /* block 98 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, /* block 99 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,119,119,119,119,119,119,119,119,119,119, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,120,120,120,120,120,120,120,120,120,120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, /* block 100 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 101 */ -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,579,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,588,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, /* block 102 */ -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, -578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, +587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587, /* block 103 */ -578,578,578,578,578,578,578,578,578,578,578,578,578,119,119,119, -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,580,580,580,580,580,580,580,580,580,580, -580,580,580,580,580,580,580,119,119,119,119,119,119,119,119,119, -581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, -581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, -581,581,581,581,581,581,581,581,582,582,582,582,582,582,583,583, +587,587,587,587,587,587,587,587,587,587,587,587,587,120,120,120, +589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589, +589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589, +589,589,589,589,589,589,589,589,589,589,589,589,589,589,589,589, +589,589,589,589,589,589,589,120,120,120,120,120,120,120,120,120, +590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590, +590,590,590,590,590,590,590,590,590,590,590,590,590,590,590,590, +590,590,590,590,590,590,590,590,591,591,591,591,591,591,592,592, /* block 104 */ -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, /* block 105 */ -584,584,584,584,584,584,584,584,584,584,584,584,585,586,586,586, -584,584,584,584,584,584,584,584,584,584,584,584,584,584,584,584, -587,587,587,587,587,587,587,587,587,587,584,584,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -191,192,191,192,191,192,191,192,191,192,588,589,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,191,192,590,197, -199,199,199,591,543,543,543,543,543,543,543,543,543,543,591,472, +593,593,593,593,593,593,593,593,593,593,593,593,594,595,595,595, +593,593,593,593,593,593,593,593,593,593,593,593,593,593,593,593, +596,596,596,596,596,596,596,596,596,596,593,593,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +192,193,192,193,192,193,192,193,192,193,597,598,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,599,198, +200,200,200,600,552,552,552,552,552,552,552,552,552,552,600,479, /* block 106 */ -191,192,191,192,191,192,191,192,191,192,191,192,191,192,191,192, -191,192,191,192,191,192,191,192,191,192,191,192,472,472,543,543, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,593,593,593,593,593,593,593,593,593,593, -594,594,595,595,595,595,595,595,119,119,119,119,119,119,119,119, +192,193,192,193,192,193,192,193,192,193,192,193,192,193,192,193, +192,193,192,193,192,193,192,193,192,193,192,193,479,479,552,552, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,602,602,602,602,602,602,602,602,602,602, +603,603,604,604,604,604,604,604,120,120,120,120,120,120,120,120, /* block 107 */ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15,110,110,110,110,110,110,110,110,110, + 15, 15, 15, 15, 15, 15, 15,111,111,111,111,111,111,111,111,111, 15, 15, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 35, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, -109, 35, 35, 35, 35, 35, 35, 35, 35, 32, 33, 32, 33,596, 32, 33, +110, 35, 35, 35, 35, 35, 35, 35, 35, 32, 33, 32, 33,605, 32, 33, /* block 108 */ - 32, 33, 32, 33, 32, 33, 32, 33,110, 15, 15, 32, 33,597, 35, 22, - 32, 33, 32, 33, 35, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, - 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,598,599,600,601,598, 35, -602,603,604,605, 32, 33, 32, 33, 32, 33,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119, 22,109,109, 35, 22, 22, 22, 22, 22, + 32, 33, 32, 33, 32, 33, 32, 33,111, 15, 15, 32, 33,606, 35, 22, + 32, 33, 32, 33,607, 35, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, + 32, 33, 32, 33, 32, 33, 32, 33, 32, 33,608,609,610,611,608, 35, +612,613,614,615, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, 32, 33, +120,120, 32, 33,616,617,618,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120, 22,110,110, 35, 22, 22, 22, 22, 22, /* block 109 */ -606,606,607,606,606,606,607,606,606,606,606,607,606,606,606,606, -606,606,606,606,606,606,606,606,606,606,606,606,606,606,606,606, -606,606,606,608,608,607,607,608,609,609,609,609,119,119,119,119, -610,610,610,611,611,611,612,612,613,612,119,119,119,119,119,119, -614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614, -614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614, -614,614,614,614,614,614,614,614,614,614,614,614,614,614,614,614, -614,614,614,614,615,615,615,615,119,119,119,119,119,119,119,119, +619,619,620,619,619,619,620,619,619,619,619,620,619,619,619,619, +619,619,619,619,619,619,619,619,619,619,619,619,619,619,619,619, +619,619,619,621,621,620,620,621,622,622,622,622,120,120,120,120, +623,623,623,624,624,624,625,625,626,625,120,120,120,120,120,120, +627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627, +627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627, +627,627,627,627,627,627,627,627,627,627,627,627,627,627,627,627, +627,627,627,627,628,628,628,628,120,120,120,120,120,120,120,120, /* block 110 */ -616,616,617,617,617,617,617,617,617,617,617,617,617,617,617,617, -617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617, -617,617,617,617,617,617,617,617,617,617,617,617,617,617,617,617, -617,617,617,617,616,616,616,616,616,616,616,616,616,616,616,616, -616,616,616,616,618,618,119,119,119,119,119,119,119,119,619,619, -620,620,620,620,620,620,620,620,620,620,119,119,119,119,119,119, -251,251,251,251,251,251,251,251,251,251,251,251,251,251,251,251, -251,621,253,622,253,253,253,253,259,259,259,253,259,253,253,251, +629,629,630,630,630,630,630,630,630,630,630,630,630,630,630,630, +630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630, +630,630,630,630,630,630,630,630,630,630,630,630,630,630,630,630, +630,630,630,630,629,629,629,629,629,629,629,629,629,629,629,629, +629,629,629,629,631,631,120,120,120,120,120,120,120,120,632,632, +633,633,633,633,633,633,633,633,633,633,120,120,120,120,120,120, +252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252, +252,634,254,635,254,254,254,254,260,260,260,254,260,254,254,252, /* block 111 */ -623,623,623,623,623,623,623,623,623,623,624,624,624,624,624,624, -624,624,624,624,624,624,624,624,624,624,624,624,624,624,624,624, -624,624,624,624,624,624,625,625,625,625,625,625,625,625,626,627, -628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,628, -628,628,628,628,628,628,628,629,629,629,629,629,629,629,629,629, -629,629,630,630,119,119,119,119,119,119,119,119,119,119,119,631, -355,355,355,355,355,355,355,355,355,355,355,355,355,355,355,355, -355,355,355,355,355,355,355,355,355,355,355,355,355,119,119,119, +636,636,636,636,636,636,636,636,636,636,637,637,637,637,637,637, +637,637,637,637,637,637,637,637,637,637,637,637,637,637,637,637, +637,637,637,637,637,637,638,638,638,638,638,638,638,638,639,640, +641,641,641,641,641,641,641,641,641,641,641,641,641,641,641,641, +641,641,641,641,641,641,641,642,642,642,642,642,642,642,642,642, +642,642,643,643,120,120,120,120,120,120,120,120,120,120,120,644, +357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, +357,357,357,357,357,357,357,357,357,357,357,357,357,120,120,120, /* block 112 */ -632,632,632,633,634,634,634,634,634,634,634,634,634,634,634,634, -634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634, -634,634,634,634,634,634,634,634,634,634,634,634,634,634,634,634, -634,634,634,632,633,633,632,632,632,632,633,633,632,633,633,633, -633,635,635,635,635,635,635,635,635,635,635,635,635,635,119,636, -637,637,637,637,637,637,637,637,637,637,119,119,119,119,635,635, -343,343,343,343,343,345,638,343,343,343,343,343,343,343,343,343, -349,349,349,349,349,349,349,349,349,349,343,343,343,343,343,119, +645,645,645,646,647,647,647,647,647,647,647,647,647,647,647,647, +647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,647, +647,647,647,647,647,647,647,647,647,647,647,647,647,647,647,647, +647,647,647,645,646,646,645,645,645,645,646,646,645,645,646,646, +646,648,648,648,648,648,648,648,648,648,648,648,648,648,120,649, +650,650,650,650,650,650,650,650,650,650,120,120,120,120,648,648, +345,345,345,345,345,347,651,345,345,345,345,345,345,345,345,345, +351,351,351,351,351,351,351,351,351,351,345,345,345,345,345,120, /* block 113 */ -639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639, -639,639,639,639,639,639,639,639,639,639,639,639,639,639,639,639, -639,639,639,639,639,639,639,639,639,640,640,640,640,640,640,641, -641,640,640,641,641,640,640,119,119,119,119,119,119,119,119,119, -639,639,639,640,639,639,639,639,639,639,639,639,640,641,119,119, -642,642,642,642,642,642,642,642,642,642,119,119,643,643,643,643, -343,343,343,343,343,343,343,343,343,343,343,343,343,343,343,343, -638,343,343,343,343,343,343,350,350,350,343,344,345,344,343,343, +652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652, +652,652,652,652,652,652,652,652,652,652,652,652,652,652,652,652, +652,652,652,652,652,652,652,652,652,653,653,653,653,653,653,654, +654,653,653,654,654,653,653,120,120,120,120,120,120,120,120,120, +652,652,652,653,652,652,652,652,652,652,652,652,653,654,120,120, +655,655,655,655,655,655,655,655,655,655,120,120,656,656,656,656, +345,345,345,345,345,345,345,345,345,345,345,345,345,345,345,345, +651,345,345,345,345,345,345,352,352,352,345,346,347,346,345,345, /* block 114 */ -644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644, -644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644, -644,644,644,644,644,644,644,644,644,644,644,644,644,644,644,644, -645,644,645,645,645,644,644,645,645,644,644,644,644,644,645,645, -644,645,644,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,644,644,646,647,647, -648,648,648,648,648,648,648,648,648,648,648,649,650,650,649,649, -651,651,648,652,652,649,650,119,119,119,119,119,119,119,119,119, +657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +658,657,658,658,658,657,657,658,658,657,657,657,657,657,658,658, +657,658,657,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,657,657,659,660,660, +661,661,661,661,661,661,661,661,661,661,661,662,663,663,662,662, +664,664,661,665,665,662,663,120,120,120,120,120,120,120,120,120, /* block 115 */ -119,358,358,358,358,358,358,119,119,358,358,358,358,358,358,119, -119,358,358,358,358,358,358,119,119,119,119,119,119,119,119,119, -358,358,358,358,358,358,358,119,358,358,358,358,358,358,358,119, +120,360,360,360,360,360,360,120,120,360,360,360,360,360,360,120, +120,360,360,360,360,360,360,120,120,120,120,120,120,120,120,120, +360,360,360,360,360,360,360,120,360,360,360,360,360,360,360,120, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35,653, 35, 35, 35, 35, 35, 35, 35, 15,109,109,109,109, - 35, 35, 35, 35, 35,127,119,119,119,119,119,119,119,119,119,119, -654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, + 35, 35, 35,666, 35, 35, 35, 35, 35, 35, 35, 15,110,110,110,110, + 35, 35, 35, 35, 35,128, 35, 35,120,120,120,120,120,120,120,120, +667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, /* block 116 */ -654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, -654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, -654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, -654,654,654,654,654,654,654,654,654,654,654,654,654,654,654,654, -648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,648, -648,648,648,648,648,648,648,648,648,648,648,648,648,648,648,648, -648,648,648,649,649,650,649,649,650,649,649,651,649,650,119,119, -655,655,655,655,655,655,655,655,655,655,119,119,119,119,119,119, +667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, +667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, +667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, +667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, +661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,661, +661,661,661,661,661,661,661,661,661,661,661,661,661,661,661,661, +661,661,661,662,662,663,662,662,663,662,662,664,662,663,120,120, +668,668,668,668,668,668,668,668,668,668,120,120,120,120,120,120, /* block 117 */ -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, /* block 118 */ -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, /* block 119 */ -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, /* block 120 */ -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, /* block 121 */ -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, /* block 122 */ -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, /* block 123 */ -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -656,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,656,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,656,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +669,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,669,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,669,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, /* block 124 */ -657,657,657,657,657,657,657,657,656,657,657,657,657,657,657,657, -657,657,657,657,657,657,657,657,657,657,657,657,657,657,657,657, -657,657,657,657,119,119,119,119,119,119,119,119,119,119,119,119, -356,356,356,356,356,356,356,356,356,356,356,356,356,356,356,356, -356,356,356,356,356,356,356,119,119,119,119,357,357,357,357,357, -357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, -357,357,357,357,357,357,357,357,357,357,357,357,357,357,357,357, -357,357,357,357,357,357,357,357,357,357,357,357,119,119,119,119, +670,670,670,670,670,670,670,670,669,670,670,670,670,670,670,670, +670,670,670,670,670,670,670,670,670,670,670,670,670,670,670,670, +670,670,670,670,120,120,120,120,120,120,120,120,120,120,120,120, +358,358,358,358,358,358,358,358,358,358,358,358,358,358,358,358, +358,358,358,358,358,358,358,120,120,120,120,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,359,359,359,359, +359,359,359,359,359,359,359,359,359,359,359,359,120,120,120,120, /* block 125 */ -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, -658,658,658,658,658,658,658,658,658,658,658,658,658,658,658,658, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, +671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, /* block 126 */ -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, /* block 127 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, /* block 128 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 129 */ - 35, 35, 35, 35, 35, 35, 35,119,119,119,119,119,119,119,119,119, -119,119,119,205,205,205,205,205,119,119,119,119,119,214,211,214, -214,214,214,214,214,214,214,214,214,660,214,214,214,214,214,214, -214,214,214,214,214,214,214,119,214,214,214,214,214,119,214,119, -214,214,119,214,214,119,214,214,214,214,214,214,214,214,214,214, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, + 35, 35, 35, 35, 35, 35, 35,120,120,120,120,120,120,120,120,120, +120,120,120,206,206,206,206,206,120,120,120,120,120,215,212,215, +215,215,215,215,215,215,215,215,215,673,215,215,215,215,215,215, +215,215,215,215,215,215,215,120,215,215,215,215,215,120,215,120, +215,215,120,215,215,120,215,215,215,215,215,215,215,215,215,215, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 130 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,661,661,661,661,661,661,661,661,661,661,661,661,661,661, -661,661,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,674,674,674,674,674,674,674,674,674,674,674,674,674,674, +674,674,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 131 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 132 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224, 8, 7, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225, 8, 7, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, /* block 133 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -119,119,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -224,224,662,224,224,224,224,224,224,224,224,224,219,663,119,119, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +120,120,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +225,225,675,225,225,225,225,225,225,225,225,225,220,676,120,120, /* block 134 */ -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, - 5, 5, 5, 5, 5, 5, 5, 7, 8, 5,119,119,119,119,119,119, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,543,543, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, + 5, 5, 5, 5, 5, 5, 5, 7, 8, 5,120,120,120,120,120,120, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,552,552, 5, 10, 10, 16, 16, 7, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, - 8, 7, 8, 7, 8,547,547, 7, 8, 5, 5, 5, 5, 16, 16, 16, - 5, 5, 5,119, 5, 5, 5, 5, 10, 7, 8, 7, 8, 7, 8, 5, - 5, 5, 9, 10, 9, 9, 9,119, 5, 6, 5, 5,119,119,119,119, -224,224,224,224,224,119,224,224,224,224,224,224,224,224,224,224, + 8, 7, 8, 7, 8,556,556, 7, 8, 5, 5, 5, 5, 16, 16, 16, + 5, 5, 5,120, 5, 5, 5, 5, 10, 7, 8, 7, 8, 7, 8, 5, + 5, 5, 9, 10, 9, 9, 9,120, 5, 6, 5, 5,120,120,120,120, +225,225,225,225,225,120,225,225,225,225,225,225,225,225,225,225, /* block 135 */ -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,119,119, 24, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,120,120, 24, /* block 136 */ -119, 5, 5, 5, 6, 5, 5, 5, 7, 8, 5, 9, 5, 10, 5, 5, +120, 5, 5, 5, 6, 5, 5, 5, 7, 8, 5, 9, 5, 10, 5, 5, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 5, 5, 9, 9, 9, 5, 5, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 7, 5, 8, 15, 16, 15, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 7, 9, 8, 9, 7, - 8,546,551,552,546,546,569,569,569,569,569,569,569,569,569,569, -560,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, + 8,555,560,561,555,555,578,578,578,578,578,578,578,578,578,578, +569,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, /* block 137 */ -569,569,569,569,569,569,569,569,569,569,569,569,569,569,569,569, -569,569,569,569,569,569,569,569,569,569,569,569,569,569,664,664, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,572, -572,572,572,572,572,572,572,572,572,572,572,572,572,572,572,119, -119,119,572,572,572,572,572,572,119,119,572,572,572,572,572,572, -119,119,572,572,572,572,572,572,119,119,572,572,572,119,119,119, - 6, 6, 9, 15, 20, 6, 6,119, 20, 9, 9, 9, 9, 20, 20,119, -502,502,502,502,502,502,502,502,502, 24, 24, 24, 20, 20,119,119, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,578,578, +578,578,578,578,578,578,578,578,578,578,578,578,578,578,677,677, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,581, +581,581,581,581,581,581,581,581,581,581,581,581,581,581,581,120, +120,120,581,581,581,581,581,581,120,120,581,581,581,581,581,581, +120,120,581,581,581,581,581,581,120,120,581,581,581,120,120,120, + 6, 6, 9, 15, 20, 6, 6,120, 20, 9, 9, 9, 9, 20, 20,120, +511,511,511,511,511,511,511,511,511, 24, 24, 24, 20, 20,120,120, /* block 138 */ -665,665,665,665,665,665,665,665,665,665,665,665,119,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,119,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,119,665,665,119,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,119,119, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +678,678,678,678,678,678,678,678,678,678,678,678,120,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,120,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,120,678,678,120,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,120,120, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 139 */ -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,665,665,665,665,665, -665,665,665,665,665,665,665,665,665,665,665,119,119,119,119,119, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, +678,678,678,678,678,678,678,678,678,678,678,120,120,120,120,120, /* block 140 */ -666,666,666,119,119,119,119,667,667,667,667,667,667,667,667,667, -667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, -667,667,667,667,667,667,667,667,667,667,667,667,667,667,667,667, -667,667,667,667,119,119,119,668,668,668,668,668,668,668,668,668, -669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669, -669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669, -669,669,669,669,669,669,669,669,669,669,669,669,669,669,669,669, -669,669,669,669,669,670,670,670,670,671,671,671,671,671,671,671, +679,679,679,120,120,120,120,680,680,680,680,680,680,680,680,680, +680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680, +680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680, +680,680,680,680,120,120,120,681,681,681,681,681,681,681,681,681, +682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, +682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, +682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, +682,682,682,682,682,683,683,683,683,684,684,684,684,684,684,684, /* block 141 */ -671,671,671,671,671,671,671,671,671,671,670,670,671,671,671,119, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119, -671,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +684,684,684,684,684,684,684,684,684,684,683,683,684,684,684,120, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120, +684,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,112,119,119, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,113,120,120, /* block 142 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 143 */ -672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, -672,672,672,672,672,672,672,672,672,672,672,672,672,119,119,119, -673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, -673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, -673,673,673,673,673,673,673,673,673,673,673,673,673,673,673,673, -673,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -674,675,675,675,675,675,675,675,675,675,675,675,675,675,675,675, -675,675,675,675,675,675,675,675,675,675,675,675,119,119,119,119, +685,685,685,685,685,685,685,685,685,685,685,685,685,685,685,685, +685,685,685,685,685,685,685,685,685,685,685,685,685,120,120,120, +686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686, +686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686, +686,686,686,686,686,686,686,686,686,686,686,686,686,686,686,686, +686,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +687,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, +688,688,688,688,688,688,688,688,688,688,688,688,120,120,120,120, /* block 144 */ -676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676, -676,676,676,676,676,676,676,676,676,676,676,676,676,676,676,676, -677,677,677,677,119,119,119,119,119,119,119,119,119,676,676,676, -678,678,678,678,678,678,678,678,678,678,678,678,678,678,678,678, -678,679,678,678,678,678,678,678,678,678,679,119,119,119,119,119, -680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680, -680,680,680,680,680,680,680,680,680,680,680,680,680,680,680,680, -680,680,680,680,680,680,681,681,681,681,681,119,119,119,119,119, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +690,690,690,690,120,120,120,120,120,120,120,120,120,689,689,689, +691,691,691,691,691,691,691,691,691,691,691,691,691,691,691,691, +691,692,691,691,691,691,691,691,691,691,692,120,120,120,120,120, +693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693, +693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693, +693,693,693,693,693,693,694,694,694,694,694,120,120,120,120,120, /* block 145 */ -682,682,682,682,682,682,682,682,682,682,682,682,682,682,682,682, -682,682,682,682,682,682,682,682,682,682,682,682,682,682,119,683, -684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, -684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, -684,684,684,684,119,119,119,119,684,684,684,684,684,684,684,684, -685,686,686,686,686,686,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695, +695,695,695,695,695,695,695,695,695,695,695,695,695,695,120,696, +697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, +697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, +697,697,697,697,120,120,120,120,697,697,697,697,697,697,697,697, +698,699,699,699,699,699,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 146 */ -687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687, -687,687,687,687,687,687,687,687,687,687,687,687,687,687,687,687, -687,687,687,687,687,687,687,687,688,688,688,688,688,688,688,688, -688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, -688,688,688,688,688,688,688,688,688,688,688,688,688,688,688,688, -689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, -689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, -689,689,689,689,689,689,689,689,689,689,689,689,689,689,689,689, +700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700, +700,700,700,700,700,700,700,700,700,700,700,700,700,700,700,700, +700,700,700,700,700,700,700,700,701,701,701,701,701,701,701,701, +701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,701, +701,701,701,701,701,701,701,701,701,701,701,701,701,701,701,701, +702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702, +702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702, +702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702, /* block 147 */ -690,690,690,690,690,690,690,690,690,690,690,690,690,690,690,690, -690,690,690,690,690,690,690,690,690,690,690,690,690,690,119,119, -691,691,691,691,691,691,691,691,691,691,119,119,119,119,119,119, -692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692, -692,692,692,692,692,692,692,692,692,692,692,692,692,692,692,692, -692,692,692,692,119,119,119,119,693,693,693,693,693,693,693,693, -693,693,693,693,693,693,693,693,693,693,693,693,693,693,693,693, -693,693,693,693,693,693,693,693,693,693,693,693,119,119,119,119, +703,703,703,703,703,703,703,703,703,703,703,703,703,703,703,703, +703,703,703,703,703,703,703,703,703,703,703,703,703,703,120,120, +704,704,704,704,704,704,704,704,704,704,120,120,120,120,120,120, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, +705,705,705,705,120,120,120,120,706,706,706,706,706,706,706,706, +706,706,706,706,706,706,706,706,706,706,706,706,706,706,706,706, +706,706,706,706,706,706,706,706,706,706,706,706,120,120,120,120, /* block 148 */ -694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694, -694,694,694,694,694,694,694,694,694,694,694,694,694,694,694,694, -694,694,694,694,694,694,694,694,119,119,119,119,119,119,119,119, -695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695, -695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695, -695,695,695,695,695,695,695,695,695,695,695,695,695,695,695,695, -695,695,695,695,119,119,119,119,119,119,119,119,119,119,119,696, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707, +707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707, +707,707,707,707,707,707,707,707,120,120,120,120,120,120,120,120, +708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708, +708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708, +708,708,708,708,708,708,708,708,708,708,708,708,708,708,708,708, +708,708,708,708,120,120,120,120,120,120,120,120,120,120,120,709, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 149 */ -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, /* block 150 */ -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,697,119,119,119,119,119,119,119,119,119, -697,697,697,697,697,697,697,697,697,697,697,697,697,697,697,697, -697,697,697,697,697,697,119,119,119,119,119,119,119,119,119,119, -697,697,697,697,697,697,697,697,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,710,120,120,120,120,120,120,120,120,120, +710,710,710,710,710,710,710,710,710,710,710,710,710,710,710,710, +710,710,710,710,710,710,120,120,120,120,120,120,120,120,120,120, +710,710,710,710,710,710,710,710,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 151 */ -698,698,698,698,698,698,119,119,698,119,698,698,698,698,698,698, -698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, -698,698,698,698,698,698,698,698,698,698,698,698,698,698,698,698, -698,698,698,698,698,698,119,698,698,119,119,119,698,119,119,698, -699,699,699,699,699,699,699,699,699,699,699,699,699,699,699,699, -699,699,699,699,699,699,119,700,701,701,701,701,701,701,701,701, -702,702,702,702,702,702,702,702,702,702,702,702,702,702,702,702, -702,702,702,702,702,702,702,703,703,704,704,704,704,704,704,704, +711,711,711,711,711,711,120,120,711,120,711,711,711,711,711,711, +711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711, +711,711,711,711,711,711,711,711,711,711,711,711,711,711,711,711, +711,711,711,711,711,711,120,711,711,120,120,120,711,120,120,711, +712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712, +712,712,712,712,712,712,120,713,714,714,714,714,714,714,714,714, +715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, +715,715,715,715,715,715,715,716,716,717,717,717,717,717,717,717, /* block 152 */ -705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,705, -705,705,705,705,705,705,705,705,705,705,705,705,705,705,705,119, -119,119,119,119,119,119,119,706,706,706,706,706,706,706,706,706, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -707,707,707,707,707,707,707,707,707,707,707,707,707,707,707,707, -707,707,707,119,707,707,119,119,119,119,119,708,708,708,708,708, +718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,718, +718,718,718,718,718,718,718,718,718,718,718,718,718,718,718,120, +120,120,120,120,120,120,120,719,719,719,719,719,719,719,719,719, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +720,720,720,720,720,720,720,720,720,720,720,720,720,720,720,720, +720,720,720,120,720,720,120,120,120,120,120,721,721,721,721,721, /* block 153 */ -709,709,709,709,709,709,709,709,709,709,709,709,709,709,709,709, -709,709,709,709,709,709,710,710,710,710,710,710,119,119,119,711, -712,712,712,712,712,712,712,712,712,712,712,712,712,712,712,712, -712,712,712,712,712,712,712,712,712,712,119,119,119,119,119,713, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +722,722,722,722,722,722,722,722,722,722,722,722,722,722,722,722, +722,722,722,722,722,722,723,723,723,723,723,723,120,120,120,724, +725,725,725,725,725,725,725,725,725,725,725,725,725,725,725,725, +725,725,725,725,725,725,725,725,725,725,120,120,120,120,120,726, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 154 */ -714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,714, -714,714,714,714,714,714,714,714,714,714,714,714,714,714,714,714, -715,715,715,715,715,715,715,715,715,715,715,715,715,715,715,715, -715,715,715,715,715,715,715,715,119,119,119,119,716,716,715,715, -716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716, -119,119,716,716,716,716,716,716,716,716,716,716,716,716,716,716, -716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716, -716,716,716,716,716,716,716,716,716,716,716,716,716,716,716,716, +727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727, +727,727,727,727,727,727,727,727,727,727,727,727,727,727,727,727, +728,728,728,728,728,728,728,728,728,728,728,728,728,728,728,728, +728,728,728,728,728,728,728,728,120,120,120,120,729,729,728,728, +729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729, +120,120,729,729,729,729,729,729,729,729,729,729,729,729,729,729, +729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729, +729,729,729,729,729,729,729,729,729,729,729,729,729,729,729,729, /* block 155 */ -717,718,718,718,119,718,718,119,119,119,119,119,718,718,718,718, -717,717,717,717,119,717,717,717,119,717,717,717,717,717,717,717, -717,717,717,717,717,717,717,717,717,717,717,717,717,717,717,717, -717,717,717,717,717,717,119,119,718,718,718,119,119,119,119,718, -719,719,719,719,719,719,719,719,719,119,119,119,119,119,119,119, -720,720,720,720,720,720,720,720,720,119,119,119,119,119,119,119, -721,721,721,721,721,721,721,721,721,721,721,721,721,721,721,721, -721,721,721,721,721,721,721,721,721,721,721,721,721,722,722,723, +730,731,731,731,120,731,731,120,120,120,120,120,731,731,731,731, +730,730,730,730,120,730,730,730,120,730,730,730,730,730,730,730, +730,730,730,730,730,730,730,730,730,730,730,730,730,730,730,730, +730,730,730,730,730,730,120,120,731,731,731,120,120,120,120,731, +732,732,732,732,732,732,732,732,732,120,120,120,120,120,120,120, +733,733,733,733,733,733,733,733,733,120,120,120,120,120,120,120, +734,734,734,734,734,734,734,734,734,734,734,734,734,734,734,734, +734,734,734,734,734,734,734,734,734,734,734,734,734,735,735,736, /* block 156 */ -724,724,724,724,724,724,724,724,724,724,724,724,724,724,724,724, -724,724,724,724,724,724,724,724,724,724,724,724,724,725,725,725, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -726,726,726,726,726,726,726,726,727,726,726,726,726,726,726,726, -726,726,726,726,726,726,726,726,726,726,726,726,726,726,726,726, -726,726,726,726,726,728,728,119,119,119,119,729,729,729,729,729, -730,730,730,730,730,730,730,119,119,119,119,119,119,119,119,119, +737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737, +737,737,737,737,737,737,737,737,737,737,737,737,737,738,738,738, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +739,739,739,739,739,739,739,739,740,739,739,739,739,739,739,739, +739,739,739,739,739,739,739,739,739,739,739,739,739,739,739,739, +739,739,739,739,739,741,741,120,120,120,120,742,742,742,742,742, +743,743,743,743,743,743,743,120,120,120,120,120,120,120,120,120, /* block 157 */ -731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731, -731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731, -731,731,731,731,731,731,731,731,731,731,731,731,731,731,731,731, -731,731,731,731,731,731,119,119,119,732,732,732,732,732,732,732, -733,733,733,733,733,733,733,733,733,733,733,733,733,733,733,733, -733,733,733,733,733,733,119,119,734,734,734,734,734,734,734,734, -735,735,735,735,735,735,735,735,735,735,735,735,735,735,735,735, -735,735,735,119,119,119,119,119,736,736,736,736,736,736,736,736, +744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744, +744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744, +744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744, +744,744,744,744,744,744,120,120,120,745,745,745,745,745,745,745, +746,746,746,746,746,746,746,746,746,746,746,746,746,746,746,746, +746,746,746,746,746,746,120,120,747,747,747,747,747,747,747,747, +748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,748, +748,748,748,120,120,120,120,120,749,749,749,749,749,749,749,749, /* block 158 */ -737,737,737,737,737,737,737,737,737,737,737,737,737,737,737,737, -737,737,119,119,119,119,119,119,119,738,738,738,738,119,119,119, -119,119,119,119,119,119,119,119,119,739,739,739,739,739,739,739, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,750, +750,750,120,120,120,120,120,120,120,751,751,751,751,120,120,120, +120,120,120,120,120,120,120,120,120,752,752,752,752,752,752,752, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 159 */ -740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740, -740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740, -740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740, -740,740,740,740,740,740,740,740,740,740,740,740,740,740,740,740, -740,740,740,740,740,740,740,740,740,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753, +753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753, +753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753, +753,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753, +753,753,753,753,753,753,753,753,753,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 160 */ -741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741, -741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741, -741,741,741,741,741,741,741,741,741,741,741,741,741,741,741,741, -741,741,741,119,119,119,119,119,119,119,119,119,119,119,119,119, -742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742, -742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742, -742,742,742,742,742,742,742,742,742,742,742,742,742,742,742,742, -742,742,742,119,119,119,119,119,119,119,743,743,743,743,743,743, +754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754, +754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754, +754,754,754,754,754,754,754,754,754,754,754,754,754,754,754,754, +754,754,754,120,120,120,120,120,120,120,120,120,120,120,120,120, +755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755, +755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755, +755,755,755,755,755,755,755,755,755,755,755,755,755,755,755,755, +755,755,755,120,120,120,120,120,120,120,756,756,756,756,756,756, /* block 161 */ -744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744, -744,744,744,744,744,744,744,744,744,744,744,744,744,744,744,744, -744,744,744,744,745,745,745,745,119,119,119,119,119,119,119,119, -746,746,746,746,746,746,746,746,746,746,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757, +757,757,757,757,757,757,757,757,757,757,757,757,757,757,757,757, +757,757,757,757,758,758,758,758,120,120,120,120,120,120,120,120, +759,759,759,759,759,759,759,759,759,759,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 162 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,747, -747,747,747,747,747,747,747,747,747,747,747,747,747,747,747,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,760, +760,760,760,760,760,760,760,760,760,760,760,760,760,760,760,120, /* block 163 */ -748,748,748,748,748,748,748,748,748,748,748,748,748,748,748,748, -748,748,748,748,748,748,748,748,748,748,748,748,748,749,749,749, -749,749,749,749,749,749,749,748,119,119,119,119,119,119,119,119, -750,750,750,750,750,750,750,750,750,750,750,750,750,750,750,750, -750,750,750,750,750,750,751,751,751,751,751,751,751,751,751,751, -751,752,752,752,752,753,753,753,753,753,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +761,761,761,761,761,761,761,761,761,761,761,761,761,761,761,761, +761,761,761,761,761,761,761,761,761,761,761,761,761,762,762,762, +762,762,762,762,762,762,762,761,120,120,120,120,120,120,120,120, +763,763,763,763,763,763,763,763,763,763,763,763,763,763,763,763, +763,763,763,763,763,763,764,764,764,764,764,764,764,764,764,764, +764,765,765,765,765,766,766,766,766,766,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 164 */ -754,755,754,756,756,756,756,756,756,756,756,756,756,756,756,756, -756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,756, -756,756,756,756,756,756,756,756,756,756,756,756,756,756,756,756, -756,756,756,756,756,756,756,756,755,755,755,755,755,755,755,755, -755,755,755,755,755,755,755,757,757,757,757,757,757,757,119,119, -119,119,758,758,758,758,758,758,758,758,758,758,758,758,758,758, -758,758,758,758,758,758,759,759,759,759,759,759,759,759,759,759, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,755, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +767,767,767,767,767,767,767,767,767,767,767,767,767,767,767,767, +767,767,767,767,767,767,767,120,120,120,120,120,120,120,120,120, /* block 165 */ -760,760,761,762,762,762,762,762,762,762,762,762,762,762,762,762, -762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,762, -762,762,762,762,762,762,762,762,762,762,762,762,762,762,762,762, -761,761,761,760,760,760,760,761,761,760,760,763,763,764,763,763, -763,763,119,119,119,119,119,119,119,119,119,119,119,764,119,119, -765,765,765,765,765,765,765,765,765,765,765,765,765,765,765,765, -765,765,765,765,765,765,765,765,765,119,119,119,119,119,119,119, -766,766,766,766,766,766,766,766,766,766,119,119,119,119,119,119, +768,769,768,770,770,770,770,770,770,770,770,770,770,770,770,770, +770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,770, +770,770,770,770,770,770,770,770,770,770,770,770,770,770,770,770, +770,770,770,770,770,770,770,770,769,769,769,769,769,769,769,769, +769,769,769,769,769,769,769,771,771,771,771,771,771,771,120,120, +120,120,772,772,772,772,772,772,772,772,772,772,772,772,772,772, +772,772,772,772,772,772,773,773,773,773,773,773,773,773,773,773, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,769, /* block 166 */ -767,767,767,768,768,768,768,768,768,768,768,768,768,768,768,768, -768,768,768,768,768,768,768,768,768,768,768,768,768,768,768,768, -768,768,768,768,768,768,768,767,767,767,767,767,769,767,767,767, -767,767,767,767,767,119,770,770,770,770,770,770,770,770,770,770, -771,771,771,771,768,769,769,119,119,119,119,119,119,119,119,119, -772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772, -772,772,772,772,772,772,772,772,772,772,772,772,772,772,772,772, -772,772,772,773,774,774,772,119,119,119,119,119,119,119,119,119, +774,774,775,776,776,776,776,776,776,776,776,776,776,776,776,776, +776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776, +776,776,776,776,776,776,776,776,776,776,776,776,776,776,776,776, +775,775,775,774,774,774,774,775,775,774,774,777,777,778,777,777, +777,777,120,120,120,120,120,120,120,120,120,120,120,778,120,120, +779,779,779,779,779,779,779,779,779,779,779,779,779,779,779,779, +779,779,779,779,779,779,779,779,779,120,120,120,120,120,120,120, +780,780,780,780,780,780,780,780,780,780,120,120,120,120,120,120, /* block 167 */ -775,775,776,777,777,777,777,777,777,777,777,777,777,777,777,777, -777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,777, -777,777,777,777,777,777,777,777,777,777,777,777,777,777,777,777, -777,777,777,776,776,776,775,775,775,775,775,775,775,775,775,776, -776,777,778,778,777,779,779,779,779,775,775,775,775,779,119,119, -780,780,780,780,780,780,780,780,780,780,777,779,777,779,779,779, -119,781,781,781,781,781,781,781,781,781,781,781,781,781,781,781, -781,781,781,781,781,119,119,119,119,119,119,119,119,119,119,119, +781,781,781,782,782,782,782,782,782,782,782,782,782,782,782,782, +782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,782, +782,782,782,782,782,782,782,781,781,781,781,781,783,781,781,781, +781,781,781,781,781,120,784,784,784,784,784,784,784,784,784,784, +785,785,785,785,782,783,783,120,120,120,120,120,120,120,120,120, +786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,786, +786,786,786,786,786,786,786,786,786,786,786,786,786,786,786,786, +786,786,786,787,788,788,786,120,120,120,120,120,120,120,120,120, /* block 168 */ -782,782,782,782,782,782,782,782,782,782,782,782,782,782,782,782, -782,782,119,782,782,782,782,782,782,782,782,782,782,782,782,782, -782,782,782,782,782,782,782,782,782,782,782,782,783,783,783,784, -784,784,783,783,784,783,784,784,785,785,785,785,785,785,784,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +789,789,790,791,791,791,791,791,791,791,791,791,791,791,791,791, +791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791, +791,791,791,791,791,791,791,791,791,791,791,791,791,791,791,791, +791,791,791,790,790,790,789,789,789,789,789,789,789,789,789,790, +790,791,792,792,791,793,793,793,793,789,789,789,789,793,120,120, +794,794,794,794,794,794,794,794,794,794,791,793,791,793,793,793, +120,795,795,795,795,795,795,795,795,795,795,795,795,795,795,795, +795,795,795,795,795,120,120,120,120,120,120,120,120,120,120,120, /* block 169 */ -786,786,786,786,786,786,786,119,786,119,786,786,786,786,119,786, -786,786,786,786,786,786,786,786,786,786,786,786,786,786,119,786, -786,786,786,786,786,786,786,786,786,787,119,119,119,119,119,119, -788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788, -788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,788, -788,788,788,788,788,788,788,788,788,788,788,788,788,788,788,789, -790,790,790,789,789,789,789,789,789,789,789,119,119,119,119,119, -791,791,791,791,791,791,791,791,791,791,119,119,119,119,119,119, +796,796,796,796,796,796,796,796,796,796,796,796,796,796,796,796, +796,796,120,796,796,796,796,796,796,796,796,796,796,796,796,796, +796,796,796,796,796,796,796,796,796,796,796,796,797,797,797,798, +798,798,797,797,798,797,798,798,799,799,799,799,799,799,798,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 170 */ -792,793,794,795,119,796,796,796,796,796,796,796,796,119,119,796, -796,119,119,796,796,796,796,796,796,796,796,796,796,796,796,796, -796,796,796,796,796,796,796,796,796,119,796,796,796,796,796,796, -796,119,796,796,119,796,796,796,796,796,119,797,793,796,798,794, -792,794,794,794,794,119,119,794,794,119,119,794,794,794,119,119, -796,119,119,119,119,119,119,798,119,119,119,119,119,796,796,796, -796,796,794,794,119,119,792,792,792,792,792,792,792,119,119,119, -792,792,792,792,792,119,119,119,119,119,119,119,119,119,119,119, +800,800,800,800,800,800,800,120,800,120,800,800,800,800,120,800, +800,800,800,800,800,800,800,800,800,800,800,800,800,800,120,800, +800,800,800,800,800,800,800,800,800,801,120,120,120,120,120,120, +802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,802, +802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,802, +802,802,802,802,802,802,802,802,802,802,802,802,802,802,802,803, +804,804,804,803,803,803,803,803,803,803,803,120,120,120,120,120, +805,805,805,805,805,805,805,805,805,805,120,120,120,120,120,120, /* block 171 */ -799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799, -799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799, -799,799,799,799,799,799,799,799,799,799,799,799,799,799,799,799, -799,799,799,799,799,800,800,800,801,801,801,801,801,801,801,801, -800,800,801,801,801,800,801,799,799,799,799,802,802,802,802,802, -803,803,803,803,803,803,803,803,803,803,119,802,119,802,801,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +806,807,808,809,120,810,810,810,810,810,810,810,810,120,120,810, +810,120,120,810,810,810,810,810,810,810,810,810,810,810,810,810, +810,810,810,810,810,810,810,810,810,120,810,810,810,810,810,810, +810,120,810,810,120,810,810,810,810,810,120,811,807,810,812,808, +806,808,808,808,808,120,120,808,808,120,120,808,808,808,120,120, +810,120,120,120,120,120,120,812,120,120,120,120,120,810,810,810, +810,810,808,808,120,120,806,806,806,806,806,806,806,120,120,120, +806,806,806,806,806,120,120,120,120,120,120,120,120,120,120,120, /* block 172 */ -804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804, -804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804, -804,804,804,804,804,804,804,804,804,804,804,804,804,804,804,804, -805,806,806,807,807,807,807,807,807,806,807,806,806,805,806,807, -807,806,807,807,804,804,808,804,119,119,119,119,119,119,119,119, -809,809,809,809,809,809,809,809,809,809,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813, +813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813, +813,813,813,813,813,813,813,813,813,813,813,813,813,813,813,813, +813,813,813,813,813,814,814,814,815,815,815,815,815,815,815,815, +814,814,815,815,815,814,815,813,813,813,813,816,816,816,816,816, +817,817,817,817,817,817,817,817,817,817,120,816,120,816,815,813, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 173 */ -810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,810, -810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,810, -810,810,810,810,810,810,810,810,810,810,810,810,810,810,810,811, -812,812,813,813,813,813,119,119,812,812,812,812,813,813,812,813, -813,814,814,814,814,814,814,814,814,814,814,814,814,814,814,814, -814,814,814,814,814,814,814,814,810,810,810,810,813,813,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818, +818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818, +818,818,818,818,818,818,818,818,818,818,818,818,818,818,818,818, +819,820,820,821,821,821,821,821,821,820,821,820,820,819,820,821, +821,820,821,821,818,818,822,818,120,120,120,120,120,120,120,120, +823,823,823,823,823,823,823,823,823,823,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 174 */ -815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815, -815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815, -815,815,815,815,815,815,815,815,815,815,815,815,815,815,815,815, -816,816,816,817,817,817,817,817,817,817,817,816,816,817,816,817, -817,818,818,818,815,119,119,119,119,119,119,119,119,119,119,119, -819,819,819,819,819,819,819,819,819,819,119,119,119,119,119,119, -392,392,392,392,392,392,392,392,392,392,392,392,392,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824, +824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824, +824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,825, +826,826,827,827,827,827,120,120,826,826,826,826,827,827,826,827, +827,828,828,828,828,828,828,828,828,828,828,828,828,828,828,828, +828,828,828,828,828,828,828,828,824,824,824,824,827,827,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 175 */ -820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820, -820,820,820,820,820,820,820,820,820,820,820,820,820,820,820,820, -820,820,820,820,820,820,820,820,820,820,820,821,822,821,822,822, -821,821,821,821,821,821,822,821,119,119,119,119,119,119,119,119, -823,823,823,823,823,823,823,823,823,823,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829, +829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829, +829,829,829,829,829,829,829,829,829,829,829,829,829,829,829,829, +830,830,830,831,831,831,831,831,831,831,831,830,830,831,830,831, +831,832,832,832,829,120,120,120,120,120,120,120,120,120,120,120, +833,833,833,833,833,833,833,833,833,833,120,120,120,120,120,120, +395,395,395,395,395,395,395,395,395,395,395,395,395,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 176 */ -824,824,824,824,824,824,824,824,824,824,824,824,824,824,824,824, -824,824,824,824,824,824,824,824,824,824,824,119,119,825,825,825, -826,826,825,825,825,825,826,825,825,825,825,825,119,119,119,119, -827,827,827,827,827,827,827,827,827,827,828,828,829,829,829,830, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,834, +834,834,834,834,834,834,834,834,834,834,834,834,834,834,834,834, +834,834,834,834,834,834,834,834,834,834,834,835,836,835,836,836, +835,835,835,835,835,835,836,835,834,120,120,120,120,120,120,120, +837,837,837,837,837,837,837,837,837,837,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 177 */ -831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,831, -831,831,831,831,831,831,831,831,831,831,831,831,831,831,831,831, -831,831,831,831,831,831,831,831,831,831,831,831,832,832,832,833, -833,833,833,833,833,833,833,833,832,833,833,834,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +838,838,838,838,838,838,838,838,838,838,838,838,838,838,838,838, +838,838,838,838,838,838,838,838,838,838,838,120,120,839,839,839, +840,840,839,839,839,839,840,839,839,839,839,839,120,120,120,120, +841,841,841,841,841,841,841,841,841,841,842,842,843,843,843,844, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 178 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,835, -835,835,835,835,835,835,835,835,835,835,835,835,835,835,835,835, -836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,836, -836,836,836,836,836,836,836,836,836,836,836,836,836,836,836,836, -837,837,837,837,837,837,837,837,837,837,838,838,838,838,838,838, -838,838,838,119,119,119,119,119,119,119,119,119,119,119,119,839, - -/* block 179 */ -840,841,841,841,841,841,841,841,841,841,841,840,840,840,840,840, -840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,840, -840,840,840,840,840,840,840,840,840,840,840,840,840,840,840,840, -840,840,840,841,841,841,841,841,841,842,843,841,841,841,841,844, -844,844,844,844,844,844,844,841,119,119,119,119,119,119,119,119, -845,846,846,846,846,846,846,847,847,846,846,846,845,845,845,845, 845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,845, 845,845,845,845,845,845,845,845,845,845,845,845,845,845,845,845, +845,845,845,845,845,845,845,845,845,845,845,845,846,846,846,847, +847,847,847,847,847,847,847,847,846,847,847,848,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, -/* block 180 */ -845,845,845,845,119,119,848,848,848,848,846,846,846,846,846,846, -846,846,846,846,846,846,846,847,846,846,849,849,849,845,849,849, -849,849,849,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850, +/* block 179 */ +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,849, +849,849,849,849,849,849,849,849,849,849,849,849,849,849,849,849, 850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850, 850,850,850,850,850,850,850,850,850,850,850,850,850,850,850,850, -850,850,850,850,850,850,850,850,850,119,119,119,119,119,119,119, +851,851,851,851,851,851,851,851,851,851,852,852,852,852,852,852, +852,852,852,120,120,120,120,120,120,120,120,120,120,120,120,853, + +/* block 180 */ +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +854,854,854,854,854,854,854,854,120,120,854,854,854,854,854,854, +854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,854, +854,854,854,854,854,854,854,854,854,854,854,854,854,854,854,854, +854,855,855,855,856,856,856,856,120,120,856,856,855,855,855,855, +856,854,857,854,855,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 181 */ -851,851,851,851,851,851,851,851,851,119,851,851,851,851,851,851, -851,851,851,851,851,851,851,851,851,851,851,851,851,851,851,851, -851,851,851,851,851,851,851,851,851,851,851,851,851,851,851,852, -853,853,853,853,853,853,853,119,853,853,853,853,853,853,852,853, -851,854,854,854,854,854,119,119,119,119,119,119,119,119,119,119, -855,855,855,855,855,855,855,855,855,855,856,856,856,856,856,856, -856,856,856,856,856,856,856,856,856,856,856,856,856,119,119,119, -857,857,858,858,858,858,858,858,858,858,858,858,858,858,858,858, +858,859,859,859,859,859,859,859,859,859,859,858,858,858,858,858, +858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858, +858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858, +858,858,858,859,859,859,859,859,859,860,861,859,859,859,859,862, +862,862,862,862,862,862,862,859,120,120,120,120,120,120,120,120, +863,864,864,864,864,864,864,865,865,864,864,864,863,863,863,863, +863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,863, +863,863,863,863,863,863,863,863,863,863,863,863,863,863,863,863, /* block 182 */ -858,858,858,858,858,858,858,858,858,858,858,858,858,858,858,858, -119,119,859,859,859,859,859,859,859,859,859,859,859,859,859,859, -859,859,859,859,859,859,859,859,119,860,859,859,859,859,859,859, -859,860,859,859,860,859,859,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +863,863,863,863,866,866,866,866,866,866,864,864,864,864,864,864, +864,864,864,864,864,864,864,865,864,864,867,867,867,863,867,867, +867,867,867,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868, +868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868, +868,868,868,868,868,868,868,868,868,868,868,868,868,868,868,868, +868,868,868,868,868,868,868,868,868,120,120,120,120,120,120,120, /* block 183 */ -861,861,861,861,861,861,861,119,861,861,119,861,861,861,861,861, -861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,861, -861,861,861,861,861,861,861,861,861,861,861,861,861,861,861,861, -861,862,862,862,862,862,862,119,119,119,862,119,862,862,119,862, -862,862,862,862,862,862,863,862,119,119,119,119,119,119,119,119, -864,864,864,864,864,864,864,864,864,864,119,119,119,119,119,119, -865,865,865,865,865,865,119,865,865,119,865,865,865,865,865,865, -865,865,865,865,865,865,865,865,865,865,865,865,865,865,865,865, +869,869,869,869,869,869,869,869,869,120,869,869,869,869,869,869, +869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,869, +869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,870, +871,871,871,871,871,871,871,120,871,871,871,871,871,871,870,871, +869,872,872,872,872,872,120,120,120,120,120,120,120,120,120,120, +873,873,873,873,873,873,873,873,873,873,874,874,874,874,874,874, +874,874,874,874,874,874,874,874,874,874,874,874,874,120,120,120, +875,875,876,876,876,876,876,876,876,876,876,876,876,876,876,876, /* block 184 */ -865,865,865,865,865,865,865,865,865,865,866,866,866,866,866,119, -867,867,119,866,866,867,866,867,865,119,119,119,119,119,119,119, -868,868,868,868,868,868,868,868,868,868,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, +120,120,877,877,877,877,877,877,877,877,877,877,877,877,877,877, +877,877,877,877,877,877,877,877,120,878,877,877,877,877,877,877, +877,878,877,877,878,877,877,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 185 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -869,869,869,869,869,869,869,869,869,869,869,869,869,869,869,869, -869,869,869,870,870,871,871,872,872,119,119,119,119,119,119,119, +879,879,879,879,879,879,879,120,879,879,120,879,879,879,879,879, +879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,879, +879,879,879,879,879,879,879,879,879,879,879,879,879,879,879,879, +879,880,880,880,880,880,880,120,120,120,880,120,880,880,120,880, +880,880,880,880,880,880,881,880,120,120,120,120,120,120,120,120, +882,882,882,882,882,882,882,882,882,882,120,120,120,120,120,120, +883,883,883,883,883,883,120,883,883,120,883,883,883,883,883,883, +883,883,883,883,883,883,883,883,883,883,883,883,883,883,883,883, /* block 186 */ -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, +883,883,883,883,883,883,883,883,883,883,884,884,884,884,884,120, +885,885,120,884,884,885,884,885,883,120,120,120,120,120,120,120, +886,886,886,886,886,886,886,886,886,886,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 187 */ -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +887,887,887,887,887,887,887,887,887,887,887,887,887,887,887,887, +887,887,887,888,888,889,889,890,890,120,120,120,120,120,120,120, /* block 188 */ -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,874, -874,874,874,874,874,874,874,874,874,874,874,874,874,874,874,119, -875,875,875,875,875,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891, +294,294,891,294,891,296,296,296,296,296,296,296,296,297,297,297, +297,296,296,296,296,296,296,296,296,296,296,296,296,296,296,296, +296,296,120,120,120,120,120,120,120,120,120,120,120,120,120,892, /* block 189 */ -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,873,873,873,873,873,873,873,873,873,873,873,873, -873,873,873,873,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, /* block 190 */ -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 191 */ -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,876, -876,876,876,876,876,876,876,876,876,876,876,876,876,876,876,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,894, +894,894,894,894,894,894,894,894,894,894,894,894,894,894,894,120, +895,895,895,895,895,120,120,120,120,120,120,120,120,120,120,120, /* block 192 */ -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, +893,893,893,893,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 193 */ -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,877,877,877,877,877,877,877,877,877, -877,877,877,877,877,877,877,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, /* block 194 */ -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, +896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,120, +897,897,897,897,897,897,897,897,897,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 195 */ -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,592,592,592,592,592,592,592, -592,592,592,592,592,592,592,592,592,119,119,119,119,119,119,119, -878,878,878,878,878,878,878,878,878,878,878,878,878,878,878,878, -878,878,878,878,878,878,878,878,878,878,878,878,878,878,878,119, -879,879,879,879,879,879,879,879,879,879,119,119,119,119,880,880, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, /* block 196 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -881,881,881,881,881,881,881,881,881,881,881,881,881,881,881,881, -881,881,881,881,881,881,881,881,881,881,881,881,881,881,119,119, -882,882,882,882,882,883,119,119,119,119,119,119,119,119,119,119, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,898,898,898,898,898,898,898,898,898, +898,898,898,898,898,898,898,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 197 */ -884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884, -884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884, -884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884, -885,885,885,885,885,885,885,886,886,886,886,886,887,887,887,887, -888,888,888,888,886,887,119,119,119,119,119,119,119,119,119,119, -889,889,889,889,889,889,889,889,889,889,119,890,890,890,890,890, -890,890,119,884,884,884,884,884,884,884,884,884,884,884,884,884, -884,884,884,884,884,884,884,884,119,119,119,119,119,884,884,884, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, /* block 198 */ -884,884,884,884,884,884,884,884,884,884,884,884,884,884,884,884, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,601,601,601,601,601,601,601, +601,601,601,601,601,601,601,601,601,120,120,120,120,120,120,120, +899,899,899,899,899,899,899,899,899,899,899,899,899,899,899,899, +899,899,899,899,899,899,899,899,899,899,899,899,899,899,899,120, +900,900,900,900,900,900,900,900,900,900,120,120,120,120,901,901, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 199 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891, -891,891,891,891,891,891,891,891,891,891,891,891,891,891,891,891, -892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892, -892,892,892,892,892,892,892,892,892,892,892,892,892,892,892,892, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, +902,902,902,902,902,902,902,902,902,902,902,902,902,902,120,120, +903,903,903,903,903,904,120,120,120,120,120,120,120,120,120,120, /* block 200 */ -893,893,893,893,893,893,893,893,893,893,893,893,893,893,893,893, -893,893,893,893,893,893,893,894,894,894,894,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905, +905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905, +905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905, +906,906,906,906,906,906,906,907,907,907,907,907,908,908,908,908, +909,909,909,909,907,908,120,120,120,120,120,120,120,120,120,120, +910,910,910,910,910,910,910,910,910,910,120,911,911,911,911,911, +911,911,120,905,905,905,905,905,905,905,905,905,905,905,905,905, +905,905,905,905,905,905,905,905,120,120,120,120,120,905,905,905, /* block 201 */ -895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895, -895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895, -895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895, -895,895,895,895,895,895,895,895,895,895,895,895,895,895,895,895, -895,895,895,895,895,119,119,119,119,119,119,119,119,119,119,119, -895,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, -896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,896, -896,896,896,896,896,896,896,896,896,896,896,896,896,896,896,119, +905,905,905,905,905,905,905,905,905,905,905,905,905,905,905,905, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 202 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,897, -897,897,897,898,898,898,898,898,898,898,898,898,898,898,898,898, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -899,900,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, +912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, +913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,913, +913,913,913,913,913,913,913,913,913,913,913,913,913,913,913,913, /* block 203 */ -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, +914,914,914,914,914,914,914,914,914,914,914,914,914,914,914,914, +914,914,914,914,914,914,914,915,915,915,915,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 204 */ -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916, +916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916, +916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916, +916,916,916,916,916,916,916,916,916,916,916,916,916,916,916,916, +916,916,916,916,916,916,916,916,916,916,916,120,120,120,120,917, +916,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918, +918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918, +918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918, /* block 205 */ -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,901,901,901,901,901,901,901,901,901,901,901,901,901, -901,901,901,119,119,119,119,119,119,119,119,119,119,119,119,119, +918,918,918,918,918,918,918,918,120,120,120,120,120,120,120,917, +917,917,917,919,919,919,919,919,919,919,919,919,919,919,919,919, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +920,921, 5,111,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 206 */ -569,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, /* block 207 */ -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,120,120,120,120,120,120,120,120, /* block 208 */ -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,564, -564,564,564,564,564,564,564,564,564,564,564,564,564,564,564,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,922,922,922,922,922,922,922,922,922,922,922,922,922, +922,922,922,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 209 */ -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, +578,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, /* block 210 */ -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,902,902,902,902, -902,902,902,902,902,902,902,902,902,902,902,902,119,119,119,119, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, /* block 211 */ -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,903,903,903,903,903, -903,903,903,903,903,903,903,903,903,903,903,119,119,119,119,119, -903,903,903,903,903,903,903,903,903,903,903,903,903,119,119,119, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, +573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +573,573,573,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,578,578,578,578,120,120,120,120,120,120,120,120, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, /* block 212 */ -903,903,903,903,903,903,903,903,903,119,119,119,119,119,119,119, -903,903,903,903,903,903,903,903,903,903,119,119,904,905,905,906, -907,907,907,907,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, /* block 213 */ +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +923,923,923,923,923,923,923,923,923,923,923,923,120,120,120,120, + +/* block 214 */ +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, +924,924,924,924,924,924,924,924,924,924,924,120,120,120,120,120, +924,924,924,924,924,924,924,924,924,924,924,924,924,120,120,120, + +/* block 215 */ +924,924,924,924,924,924,924,924,924,120,120,120,120,120,120,120, +924,924,924,924,924,924,924,924,924,924,120,120,925,926,926,927, +928,928,928,928,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 216 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, @@ -3802,309 +3867,339 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119,119, + 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120,120, -/* block 214 */ +/* block 217 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20,119,119, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20,120,120, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20,908,909,112,112,112, 20, 20, 20,909,908,908, -908,908,908, 24, 24, 24, 24, 24, 24, 24, 24,112,112,112,112,112, + 20, 20, 20, 20, 20,929,930,113,113,113, 20, 20, 20,930,929,929, +929,929,929, 24, 24, 24, 24, 24, 24, 24, 24,113,113,113,113,113, -/* block 215 */ -112,112,112, 20, 20,112,112,112,112,112,112,112, 20, 20, 20, 20, +/* block 218 */ +113,113,113, 20, 20,113,113,113,113,113,113,113, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,112,112,112,112, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,113,113,113,113, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, + 20, 20, 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, -/* block 216 */ -671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, -671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, -671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, -671,671,671,671,671,671,671,671,671,671,671,671,671,671,671,671, -671,671,910,910,910,671,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +/* block 219 */ +684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, +684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, +684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, +684,684,684,684,684,684,684,684,684,684,684,684,684,684,684,684, +684,684,931,931,931,684,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, -/* block 217 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +/* block 220 */ +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25,119,119,119,119,119,119,119,119,119,119,119,119, + 25, 25, 25, 25,120,120,120,120,120,120,120,120,120,120,120,120, -/* block 218 */ +/* block 221 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20,119,119,119,119,119,119,119,119,119, -573,573,573,573,573,573,573,573,573,573,573,573,573,573,573,573, -573,573, 25, 25, 25, 25, 25, 25, 25,119,119,119,119,119,119,119, - -/* block 219 */ -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,505,505, -505,505,505,505,505,119,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, - -/* block 220 */ -504,504,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,504,119,504,504, -119,119,504,119,119,504,504,119,119,504,504,504,504,119,504,504, -504,504,504,504,504,504,505,505,505,505,119,505,119,505,505,505, -505,505,505,505,119,505,505,505,505,505,505,505,505,505,505,505, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, - -/* block 221 */ -505,505,505,505,504,504,119,504,504,504,504,119,119,504,504,504, -504,504,504,504,504,119,504,504,504,504,504,504,504,119,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,504,504,119,504,504,504,504,119, -504,504,504,504,504,119,504,119,119,119,504,504,504,504,504,504, -504,119,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, + 20, 20, 20, 20, 20, 20, 20,120,120,120,120,120,120,120,120,120, +582,582,582,582,582,582,582,582,582,582,582,582,582,582,582,582, +582,582, 25, 25, 25, 25, 25, 25, 25,120,120,120,120,120,120,120, /* block 222 */ -504,504,504,504,504,504,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,514,514, +514,514,514,514,514,120,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, /* block 223 */ -505,505,505,505,505,505,505,505,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, +513,513,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,513,120,513,513, +120,120,513,120,120,513,513,120,120,513,513,513,513,120,513,513, +513,513,513,513,513,513,514,514,514,514,120,514,120,514,514,514, +514,514,514,514,120,514,514,514,514,514,514,514,514,514,514,514, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, /* block 224 */ -504,504,504,504,504,504,504,504,504,504,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,119,119,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504, 9,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505, 9,505,505,505,505, -505,505,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504, 9,505,505,505,505, +514,514,514,514,513,513,120,513,513,513,513,120,120,513,513,513, +513,513,513,513,513,120,513,513,513,513,513,513,513,120,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,513,513,120,513,513,513,513,120, +513,513,513,513,513,120,513,120,120,120,513,513,513,513,513,513, +513,120,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, /* block 225 */ -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505, 9,505,505,505,505,505,505,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504, 9,505,505,505,505,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, 9, -505,505,505,505,505,505,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, 9, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, +513,513,513,513,513,513,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, /* block 226 */ -505,505,505,505,505,505,505,505,505, 9,505,505,505,505,505,505, -504,504,504,504,504,504,504,504,504,504,504,504,504,504,504,504, -504,504,504,504,504,504,504,504,504, 9,505,505,505,505,505,505, -505,505,505,505,505,505,505,505,505,505,505,505,505,505,505,505, -505,505,505, 9,505,505,505,505,505,505,504,505,119,119, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +514,514,514,514,514,514,514,514,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, /* block 227 */ -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, -911,911,911,911,911,911,911,911,911,911,911,911,911,911,911,911, +513,513,513,513,513,513,513,513,513,513,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,120,120,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513, 9,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514, 9,514,514,514,514, +514,514,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513, 9,514,514,514,514, /* block 228 */ -912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -912,912,912,912,912,912,912,911,911,911,911,912,912,912,912,912, -912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -912,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -912,912,912,912,912,912,912,912,912,912,912,912,912,911,911,911, -911,911,911,911,911,912,911,911,911,911,911,911,911,911,911,911, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514, 9,514,514,514,514,514,514,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513, 9,514,514,514,514,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, 9, +514,514,514,514,514,514,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, 9, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, /* block 229 */ -911,911,911,911,912,911,911,913,913,913,913,913,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,912,912,912,912,912, -119,912,912,912,912,912,912,912,912,912,912,912,912,912,912,912, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +514,514,514,514,514,514,514,514,514, 9,514,514,514,514,514,514, +513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513, +513,513,513,513,513,513,513,513,513, 9,514,514,514,514,514,514, +514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514, +514,514,514, 9,514,514,514,514,514,514,513,514,120,120, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, /* block 230 */ -914,914,914,914,914,914,914,119,914,914,914,914,914,914,914,914, -914,914,914,914,914,914,914,914,914,119,119,914,914,914,914,914, -914,914,119,914,914,119,914,914,914,914,914,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, +932,932,932,932,932,932,932,932,932,932,932,932,932,932,932,932, /* block 231 */ -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, +933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +933,933,933,933,933,933,933,932,932,932,932,933,933,933,933,933, +933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +933,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +933,933,933,933,933,933,933,933,933,933,933,933,933,932,932,932, +932,932,932,932,932,933,932,932,932,932,932,932,932,932,932,932, /* block 232 */ -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915, -915,915,915,915,915,119,119,916,916,916,916,916,916,916,916,916, -917,917,917,917,917,917,917,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +932,932,932,932,933,932,932,934,934,934,934,934,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,933,933,933,933,933, +120,933,933,933,933,933,933,933,933,933,933,933,933,933,933,933, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 233 */ -918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918, -918,918,918,918,918,918,918,918,918,918,918,918,918,918,918,918, -918,918,919,919,919,919,919,919,919,919,919,919,919,919,919,919, -919,919,919,919,919,919,919,919,919,919,919,919,919,919,919,919, -919,919,919,919,920,920,920,920,920,920,920,119,119,119,119,119, -921,921,921,921,921,921,921,921,921,921,119,119,119,119,922,922, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +935,935,935,935,935,935,935,120,935,935,935,935,935,935,935,935, +935,935,935,935,935,935,935,935,935,120,120,935,935,935,935,935, +935,935,120,935,935,120,935,935,935,935,935,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 234 */ -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936, +936,936,936,936,936,936,936,936,936,936,936,936,936,936,936,936, +936,936,936,936,936,936,936,936,936,936,936,936,936,120,120,120, +937,937,937,937,937,937,937,938,938,938,938,938,938,938,120,120, +939,939,939,939,939,939,939,939,939,939,120,120,120,120,936,940, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 235 */ - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, 25, 25, - 6, 25, 25, 25, 25,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,941, +941,941,941,941,941,941,941,941,941,941,941,941,941,941,941,941, +941,941,941,941,941,941,941,941,941,941,941,941,942,942,942,942, +943,943,943,943,943,943,943,943,943,943,120,120,120,120,120,944, /* block 236 */ -224,224,224,224,119,224,224,224,224,224,224,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224, -119,224,224,119,224,119,119,224,119,224,224,224,224,224,224,224, -224,224,224,119,224,224,224,224,119,224,119,224,119,119,119,119, -119,119,224,119,119,119,119,224,119,224,119,224,119,224,224,224, -119,224,224,119,224,119,119,224,119,224,119,224,119,224,119,224, -119,224,224,119,224,119,119,224,224,224,224,119,224,224,224,224, -224,224,224,119,224,224,224,224,119,224,224,224,224,119,224,119, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, /* block 237 */ -224,224,224,224,224,224,224,224,224,224,119,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,119,119,119,119, -119,224,224,224,119,224,224,224,224,224,119,224,224,224,224,224, -224,224,224,224,224,224,224,224,224,224,224,224,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -217,217,119,119,119,119,119,119,119,119,119,119,119,119,119,119, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,945,945,945,945,945,945,945,945,945,945,945, +945,945,945,945,945,120,120,946,946,946,946,946,946,946,946,946, +947,947,947,947,947,947,947,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 238 */ +948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,948, +948,948,948,948,948,948,948,948,948,948,948,948,948,948,948,948, +948,948,949,949,949,949,949,949,949,949,949,949,949,949,949,949, +949,949,949,949,949,949,949,949,949,949,949,949,949,949,949,949, +949,949,949,949,950,950,950,950,950,950,950,951,120,120,120,120, +952,952,952,952,952,952,952,952,952,952,120,120,120,120,953,953, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 239 */ +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + +/* block 240 */ + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, 25, 25, + 6, 25, 25, 25, 25,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 241 */ +120, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 20, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 242 */ +225,225,225,225,120,225,225,225,225,225,225,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225, +120,225,225,120,225,120,120,225,120,225,225,225,225,225,225,225, +225,225,225,120,225,225,225,225,120,225,120,225,120,120,120,120, +120,120,225,120,120,120,120,225,120,225,120,225,120,225,225,225, +120,225,225,120,225,120,120,225,120,225,120,225,120,225,120,225, +120,225,225,120,225,120,120,225,225,225,225,120,225,225,225,225, +225,225,225,120,225,225,225,225,120,225,225,225,225,120,225,120, + +/* block 243 */ +225,225,225,225,225,225,225,225,225,225,120,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,120,120,120,120, +120,225,225,225,120,225,225,225,225,225,120,225,225,225,225,225, +225,225,225,225,225,225,225,225,225,225,225,225,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +218,218,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 244 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -/* block 239 */ +/* block 245 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923, -923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -923, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954, +954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, +954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923, + 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954, -/* block 240 */ - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,923,923,923, +/* block 246 */ + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,954,954,954, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21,954,954,954, 21, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, -/* block 241 */ +/* block 247 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,924,924,924,924,924,924,924,924,924,924, -924,924,924,924,924,924,924,924,924,924,924,924,924,924,924,924, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,955,955,955,955,955,955,955,955,955,955, +955,955,955,955,955,955,955,955,955,955,955,955,955,955,955,955, -/* block 242 */ -925, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923, +/* block 248 */ +956, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,954, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, - 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,923,923,923,923, - 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923, -575,575,923,923,923,923,923,923,923,923,923,923,923,923,923,923, - 21, 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, + 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,954,954,954,954, + 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954, +584,584,954,954,954,954,954,954,954,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, -/* block 243 */ -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, +/* block 249 */ +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, -/* block 244 */ +/* block 250 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -4114,7 +4209,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -/* block 245 */ +/* block 251 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -4122,9 +4217,9 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,926,926,926,926,926, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,957,957,957,957,957, -/* block 246 */ +/* block 252 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -4134,7 +4229,7 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, -/* block 247 */ +/* block 253 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -4144,17 +4239,17 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -/* block 248 */ +/* block 254 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923,923,923, + 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954,954, -/* block 249 */ +/* block 255 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, @@ -4162,187 +4257,197 @@ const uint16_t PRIV(ucd_stage2)[] = { /* 68608 bytes, block = 128 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20,923,923,923,923,923,923,923,923,923,923,923,923, + 20, 20, 20, 20,954,954,954,954,954,954,954,954,954,954,954,954, -/* block 250 */ +/* block 256 */ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 21, 21, 21, 21,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, + 20, 20, 20, 20, 20, 21, 21, 21, 21,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, -/* block 251 */ - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923, +/* block 257 */ + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923,923, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923, + 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954,954, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -/* block 252 */ - 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923,923,923,923,923, +/* block 258 */ + 20, 20, 20, 20, 20, 20, 20, 20,954,954,954,954,954,954,954,954, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, -/* block 253 */ - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,923,923,923,923, +/* block 259 */ + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21,923, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21,923,923, 21, 21, 21, 21,923,923,923, 21,923, 21, 21, 21, 21, + 21, 21,954, 21, 21, 21, 21,954,954,954, 21, 21, 21, 21, 21, 21, -/* block 254 */ +/* block 260 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923,923,923,923,923, - 21, 21, 21,923,923,923,923,923,923,923,923,923,923,923,923,923, + 21, 21, 21,954,954, 21, 21, 21, 21, 21, 21,954,954,954, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - -/* block 255 */ -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, - -/* block 256 */ -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,923,923, -923,923,923,923,923,923,923,923,923,923,923,923,923,923,119,119, - -/* block 257 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, - -/* block 258 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,119,119,119,119,119,119,119,119,119,119,119, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, - -/* block 259 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, - -/* block 260 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, /* block 261 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,954,954, + 21, 21, 21, 21,954,954,954,954, 21, 21, 21,954,954,954,954,954, /* block 262 */ -577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577, -577,577,577,577,577,577,577,577,577,577,577,577,577,577,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, -119,119,119,119,119,119,119,119,119,119,119,119,119,119,119,119, + 21, 21, 21,954,954,954,954,954,954,954,954,954,954,954,954,954, + 21, 21, 21, 21, 21, 21,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, /* block 263 */ -502, 24,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, -927,927,927,927,927,927,927,927,927,927,927,927,927,927,927,927, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,954,954, +954,954,954,954,954,954,954,954,954,954,954,954,954,954,120,120, /* block 264 */ -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, /* block 265 */ -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,120,120,120,120,120,120,120,120,120,120,120, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, /* block 266 */ -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112, -502,502,502,502,502,502,502,502,502,502,502,502,502,502,502,502, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, /* block 267 */ -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,659,659, -659,659,659,659,659,659,659,659,659,659,659,659,659,659,119,119, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, + +/* block 268 */ +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 269 */ +586,586,586,586,586,586,586,586,586,586,586,586,586,586,586,586, +586,586,586,586,586,586,586,586,586,586,586,586,586,586,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, +120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, + +/* block 270 */ +511, 24,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, +958,958,958,958,958,958,958,958,958,958,958,958,958,958,958,958, + +/* block 271 */ +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, + +/* block 272 */ +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, + +/* block 273 */ +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113, +511,511,511,511,511,511,511,511,511,511,511,511,511,511,511,511, + +/* block 274 */ +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,672,672, +672,672,672,672,672,672,672,672,672,672,672,672,672,672,120,120, }; diff --git a/src/3rdparty/pcre2/src/pcre2_ucp.h b/src/3rdparty/pcre2/src/pcre2_ucp.h index 483abd18fc..84b22fb064 100644 --- a/src/3rdparty/pcre2/src/pcre2_ucp.h +++ b/src/3rdparty/pcre2/src/pcre2_ucp.h @@ -281,7 +281,12 @@ enum { ucp_Makasar, ucp_Medefaidrin, ucp_Old_Sogdian, - ucp_Sogdian + ucp_Sogdian, + /* New for Unicode 12.0.0 */ + ucp_Elymaic, + ucp_Nandinagari, + ucp_Nyiakeng_Puachue_Hmong, + ucp_Wancho }; #endif /* PCRE2_UCP_H_IDEMPOTENT_GUARD */ diff --git a/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h b/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h index ba60311e45..acba9da4be 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h +++ b/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h @@ -214,6 +214,10 @@ #define SLJIT_MEMCPY(dest, src, len) memcpy(dest, src, len) #endif +#ifndef SLJIT_MEMMOVE +#define SLJIT_MEMMOVE(dest, src, len) memmove(dest, src, len) +#endif + #ifndef SLJIT_ZEROMEM #define SLJIT_ZEROMEM(dest, len) memset(dest, 0, len) #endif diff --git a/src/3rdparty/pcre2/src/sljit/sljitExecAllocator.c b/src/3rdparty/pcre2/src/sljit/sljitExecAllocator.c index 3b37a9751f..92ddb94914 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitExecAllocator.c +++ b/src/3rdparty/pcre2/src/sljit/sljitExecAllocator.c @@ -118,10 +118,20 @@ static SLJIT_INLINE int get_map_jit_flag() if (map_jit_flag == -1) { struct utsname name; + map_jit_flag = 0; uname(&name); /* Kernel version for 10.14.0 (Mojave) */ - map_jit_flag = (atoi(name.release) >= 18) ? MAP_JIT : 0; + if (atoi(name.release) >= 18) { + /* Only use MAP_JIT if a hardened runtime is used, because MAP_JIT is incompatible with fork(). */ + void *ptr = mmap(NULL, getpagesize(), PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + + if (ptr == MAP_FAILED) { + map_jit_flag = MAP_JIT; + } else { + munmap(ptr, getpagesize()); + } + } } return map_jit_flag; @@ -137,6 +147,7 @@ static SLJIT_INLINE int get_map_jit_flag() static SLJIT_INLINE void* alloc_chunk(sljit_uw size) { void *retval; + const int prot = PROT_READ | PROT_WRITE | PROT_EXEC; #ifdef MAP_ANON @@ -146,16 +157,25 @@ static SLJIT_INLINE void* alloc_chunk(sljit_uw size) flags |= get_map_jit_flag(); #endif - retval = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, flags, -1, 0); + retval = mmap(NULL, size, prot, flags, -1, 0); #else /* !MAP_ANON */ if (dev_zero < 0) { if (open_dev_zero()) return NULL; } - retval = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero, 0); + retval = mmap(NULL, size, prot, MAP_PRIVATE, dev_zero, 0); #endif /* MAP_ANON */ - return (retval != MAP_FAILED) ? retval : NULL; + if (retval == MAP_FAILED) + retval = NULL; + else { + if (mprotect(retval, size, prot) < 0) { + munmap(retval, size); + retval = NULL; + } + } + + return retval; } static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size) diff --git a/src/3rdparty/pcre2/src/sljit/sljitLir.c b/src/3rdparty/pcre2/src/sljit/sljitLir.c index ded9541b31..9bab0c3ec6 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitLir.c +++ b/src/3rdparty/pcre2/src/sljit/sljitLir.c @@ -144,6 +144,7 @@ #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) # define PATCH_MD 0x10 #endif +# define TYPE_SHIFT 13 #endif #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) @@ -521,6 +522,12 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw } } +SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label) +{ + if (SLJIT_LIKELY(!!put_label)) + put_label->label = label; +} + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags) { SLJIT_UNUSED_ARG(compiler); @@ -620,6 +627,30 @@ static SLJIT_INLINE sljit_s32 get_arg_count(sljit_s32 arg_types) return arg_count; } +#if !(defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86) + +static SLJIT_INLINE sljit_uw compute_next_addr(struct sljit_label *label, struct sljit_jump *jump, + struct sljit_const *const_, struct sljit_put_label *put_label) +{ + sljit_uw result = ~(sljit_uw)0; + + if (label) + result = label->size; + + if (jump && jump->addr < result) + result = jump->addr; + + if (const_ && const_->addr < result) + result = const_->addr; + + if (put_label && put_label->addr < result) + result = put_label->addr; + + return result; +} + +#endif /* !SLJIT_CONFIG_X86 */ + static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler, sljit_s32 options, sljit_s32 args, sljit_s32 scratches, sljit_s32 saveds, sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size) @@ -687,6 +718,19 @@ static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_comp compiler->last_const = const_; } +static SLJIT_INLINE void set_put_label(struct sljit_put_label *put_label, struct sljit_compiler *compiler, sljit_uw offset) +{ + put_label->next = NULL; + put_label->label = NULL; + put_label->addr = compiler->size - offset; + put_label->flags = 0; + if (compiler->last_put_label) + compiler->last_put_label->next = put_label; + else + compiler->put_labels = put_label; + compiler->last_put_label = put_label; +} + #define ADDRESSING_DEPENDS_ON(exp, reg) \ (((exp) & SLJIT_MEM) && (((exp) & REG_MASK) == reg || OFFS_REG(exp) == reg)) @@ -1905,6 +1949,21 @@ static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compil CHECK_RETURN_OK; } +static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ +#if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS) + FUNCTION_CHECK_DST(dst, dstw, 0); +#endif +#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) + if (SLJIT_UNLIKELY(!!compiler->verbose)) { + fprintf(compiler->verbose, " put_label "); + sljit_verbose_param(compiler, dst, dstw); + fprintf(compiler->verbose, "\n"); + } +#endif + CHECK_RETURN_OK; +} + #endif /* SLJIT_ARGUMENT_CHECKS || SLJIT_VERBOSE */ #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \ @@ -2581,6 +2640,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi return NULL; } +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + SLJIT_UNUSED_ARG(compiler); + SLJIT_UNUSED_ARG(dst); + SLJIT_UNUSED_ARG(dstw); + return NULL; +} + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) { SLJIT_UNUSED_ARG(addr); @@ -2597,4 +2664,4 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta SLJIT_UNREACHABLE(); } -#endif +#endif /* !SLJIT_CONFIG_UNSUPPORTED */ diff --git a/src/3rdparty/pcre2/src/sljit/sljitLir.h b/src/3rdparty/pcre2/src/sljit/sljitLir.h index e71890cf7b..836d25cf71 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitLir.h +++ b/src/3rdparty/pcre2/src/sljit/sljitLir.h @@ -348,13 +348,20 @@ struct sljit_label { struct sljit_jump { struct sljit_jump *next; sljit_uw addr; - sljit_sw flags; + sljit_uw flags; union { sljit_uw target; - struct sljit_label* label; + struct sljit_label *label; } u; }; +struct sljit_put_label { + struct sljit_put_label *next; + struct sljit_label *label; + sljit_uw addr; + sljit_uw flags; +}; + struct sljit_const { struct sljit_const *next; sljit_uw addr; @@ -366,10 +373,12 @@ struct sljit_compiler { struct sljit_label *labels; struct sljit_jump *jumps; + struct sljit_put_label *put_labels; struct sljit_const *consts; struct sljit_label *last_label; struct sljit_jump *last_jump; struct sljit_const *last_const; + struct sljit_put_label *last_put_label; void *allocator_data; struct sljit_memory_fragment *buf; @@ -1314,10 +1323,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compil Flags: - (may destroy flags) */ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset); -/* The constant can be changed runtime (see: sljit_set_const) +/* Store a value that can be changed runtime (see: sljit_get_const_addr / sljit_set_const) Flags: - (does not modify flags) */ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value); +/* Store the value of a label (see: sljit_set_put_label) + Flags: - (does not modify flags) */ +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw); + +/* Set the value stored by put_label to this label. */ +SLJIT_API_FUNC_ATTRIBUTE void sljit_set_put_label(struct sljit_put_label *put_label, struct sljit_label *label); + /* After the code generation the address for label, jump and const instructions are computed. Since these structures are freed by sljit_free_compiler, the addresses must be preserved by the user program elsewere. */ diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_32.c index 6d61eed9a7..71f7bcdadb 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_32.c @@ -583,8 +583,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_uw *buf_end; sljit_uw size; sljit_uw word_count; + sljit_uw next_addr; sljit_sw executable_offset; - sljit_sw jump_addr; + sljit_sw addr; #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) sljit_uw cpool_size; sljit_uw cpool_skip_alignment; @@ -597,6 +598,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -625,11 +627,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; word_count = 0; + next_addr = 1; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; if (label && label->size == 0) { label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code, executable_offset); @@ -669,35 +673,45 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil else if ((*buf_ptr & 0xff000000) != PUSH_POOL) { #endif *code_ptr = *buf_ptr++; + if (next_addr == word_count) { + SLJIT_ASSERT(!label || label->size >= word_count); + SLJIT_ASSERT(!jump || jump->addr >= word_count); + SLJIT_ASSERT(!const_ || const_->addr >= word_count); + SLJIT_ASSERT(!put_label || put_label->addr >= word_count); + /* These structures are ordered by their address. */ - SLJIT_ASSERT(!label || label->size >= word_count); - SLJIT_ASSERT(!jump || jump->addr >= word_count); - SLJIT_ASSERT(!const_ || const_->addr >= word_count); - if (jump && jump->addr == word_count) { + if (jump && jump->addr == word_count) { #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) - if (detect_jump_type(jump, code_ptr, code, executable_offset)) - code_ptr--; - jump->addr = (sljit_uw)code_ptr; + if (detect_jump_type(jump, code_ptr, code, executable_offset)) + code_ptr--; + jump->addr = (sljit_uw)code_ptr; #else - jump->addr = (sljit_uw)(code_ptr - 2); - if (detect_jump_type(jump, code_ptr, code, executable_offset)) - code_ptr -= 2; + jump->addr = (sljit_uw)(code_ptr - 2); + if (detect_jump_type(jump, code_ptr, code, executable_offset)) + code_ptr -= 2; #endif - jump = jump->next; - } - if (label && label->size == word_count) { - /* code_ptr can be affected above. */ - label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr + 1, executable_offset); - label->size = (code_ptr + 1) - code; - label = label->next; - } - if (const_ && const_->addr == word_count) { + jump = jump->next; + } + if (label && label->size == word_count) { + /* code_ptr can be affected above. */ + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr + 1, executable_offset); + label->size = (code_ptr + 1) - code; + label = label->next; + } + if (const_ && const_->addr == word_count) { #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) - const_->addr = (sljit_uw)code_ptr; + const_->addr = (sljit_uw)code_ptr; #else - const_->addr = (sljit_uw)(code_ptr - 1); + const_->addr = (sljit_uw)(code_ptr - 1); #endif - const_ = const_->next; + const_ = const_->next; + } + if (put_label && put_label->addr == word_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr++; #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) @@ -725,6 +739,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) SLJIT_ASSERT(cpool_size == 0); @@ -755,15 +770,15 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil buf_ptr = (sljit_uw *)jump->addr; if (jump->flags & PATCH_B) { - jump_addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, executable_offset); + addr = (sljit_sw)SLJIT_ADD_EXEC_OFFSET(buf_ptr + 2, executable_offset); if (!(jump->flags & JUMP_ADDR)) { SLJIT_ASSERT(jump->flags & JUMP_LABEL); - SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - jump_addr) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - jump_addr) >= -0x02000000); - *buf_ptr |= (((sljit_sw)jump->u.label->addr - jump_addr) >> 2) & 0x00ffffff; + SLJIT_ASSERT(((sljit_sw)jump->u.label->addr - addr) <= 0x01ffffff && ((sljit_sw)jump->u.label->addr - addr) >= -0x02000000); + *buf_ptr |= (((sljit_sw)jump->u.label->addr - addr) >> 2) & 0x00ffffff; } else { - SLJIT_ASSERT(((sljit_sw)jump->u.target - jump_addr) <= 0x01ffffff && ((sljit_sw)jump->u.target - jump_addr) >= -0x02000000); - *buf_ptr |= (((sljit_sw)jump->u.target - jump_addr) >> 2) & 0x00ffffff; + SLJIT_ASSERT(((sljit_sw)jump->u.target - addr) <= 0x01ffffff && ((sljit_sw)jump->u.target - addr) >= -0x02000000); + *buf_ptr |= (((sljit_sw)jump->u.target - addr) >> 2) & 0x00ffffff; } } else if (jump->flags & SLJIT_REWRITABLE_JUMP) { @@ -813,6 +828,22 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil } #endif + put_label = compiler->put_labels; + while (put_label) { + addr = put_label->label->addr; + buf_ptr = (sljit_uw*)put_label->addr; + +#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) + SLJIT_ASSERT((buf_ptr[0] & 0xffff0000) == 0xe59f0000); + buf_ptr[((buf_ptr[0] & 0xfff) >> 2) + 2] = addr; +#else + SLJIT_ASSERT((buf_ptr[-1] & 0xfff00000) == MOVW && (buf_ptr[0] & 0xfff00000) == MOVT); + buf_ptr[-1] |= ((addr << 4) & 0xf0000) | (addr & 0xfff); + buf_ptr[0] |= ((addr >> 12) & 0xf0000) | ((addr >> 16) & 0xfff); +#endif + put_label = put_label->next; + } + SLJIT_ASSERT(code_ptr - code <= (sljit_s32)size); compiler->error = SLJIT_ERR_COMPILED; @@ -2639,28 +2670,55 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compile SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) { struct sljit_const *const_; - sljit_s32 reg; + sljit_s32 dst_r; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); ADJUST_LOCAL_OFFSET(dst, dstw); + dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2; + +#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) + PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), init_value)); + compiler->patches++; +#else + PTR_FAIL_IF(emit_imm(compiler, dst_r, init_value)); +#endif + const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); PTR_FAIL_IF(!const_); + set_const(const_, compiler); - reg = SLOW_IS_REG(dst) ? dst : TMP_REG2; + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); + return const_; +} + +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + dst_r = SLOW_IS_REG(dst) ? dst : TMP_REG2; #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) - PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, 0), init_value)); + PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, dst_r, TMP_PC, 0), 0)); compiler->patches++; #else - PTR_FAIL_IF(emit_imm(compiler, reg, init_value)); + PTR_FAIL_IF(emit_imm(compiler, dst_r, 0)); #endif - set_const(const_, compiler); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); if (dst & SLJIT_MEM) PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); - return const_; + return put_label; } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_64.c b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_64.c index b015695c52..e15b3451e8 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_64.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_64.c @@ -161,7 +161,7 @@ static SLJIT_INLINE void modify_imm64_const(sljit_ins* inst, sljit_uw new_imm) inst[3] = MOVK | dst | ((new_imm >> 48) << 5) | (3 << 21); } -static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code, sljit_sw executable_offset) +static SLJIT_INLINE sljit_sw detect_jump_type(struct sljit_jump *jump, sljit_ins *code_ptr, sljit_ins *code, sljit_sw executable_offset) { sljit_sw diff; sljit_uw target_addr; @@ -196,14 +196,14 @@ static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in return 4; } - if (target_addr <= 0xffffffffl) { + if (target_addr < 0x100000000l) { if (jump->flags & IS_COND) code_ptr[-5] -= (2 << 5); code_ptr[-2] = code_ptr[0]; return 2; } - if (target_addr <= 0xffffffffffffl) { + if (target_addr < 0x1000000000000l) { if (jump->flags & IS_COND) code_ptr[-5] -= (1 << 5); jump->flags |= PATCH_ABS48; @@ -215,6 +215,22 @@ static SLJIT_INLINE sljit_s32 detect_jump_type(struct sljit_jump *jump, sljit_in return 0; } +static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label) +{ + if (max_label < 0x100000000l) { + put_label->flags = 0; + return 2; + } + + if (max_label < 0x1000000000000l) { + put_label->flags = 1; + return 1; + } + + put_label->flags = 2; + return 0; +} + SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) { struct sljit_memory_fragment *buf; @@ -223,6 +239,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_ins *buf_ptr; sljit_ins *buf_end; sljit_uw word_count; + sljit_uw next_addr; sljit_sw executable_offset; sljit_uw addr; sljit_s32 dst; @@ -230,6 +247,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -241,34 +259,47 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; word_count = 0; + next_addr = 0; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; do { buf_ptr = (sljit_ins*)buf->memory; buf_end = buf_ptr + (buf->used_size >> 2); do { *code_ptr = *buf_ptr++; - /* These structures are ordered by their address. */ - SLJIT_ASSERT(!label || label->size >= word_count); - SLJIT_ASSERT(!jump || jump->addr >= word_count); - SLJIT_ASSERT(!const_ || const_->addr >= word_count); - if (label && label->size == word_count) { - label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); - label->size = code_ptr - code; - label = label->next; - } - if (jump && jump->addr == word_count) { - jump->addr = (sljit_uw)(code_ptr - 4); - code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset); - jump = jump->next; - } - if (const_ && const_->addr == word_count) { - const_->addr = (sljit_uw)code_ptr; - const_ = const_->next; + if (next_addr == word_count) { + SLJIT_ASSERT(!label || label->size >= word_count); + SLJIT_ASSERT(!jump || jump->addr >= word_count); + SLJIT_ASSERT(!const_ || const_->addr >= word_count); + SLJIT_ASSERT(!put_label || put_label->addr >= word_count); + + /* These structures are ordered by their address. */ + if (label && label->size == word_count) { + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); + label->size = code_ptr - code; + label = label->next; + } + if (jump && jump->addr == word_count) { + jump->addr = (sljit_uw)(code_ptr - 4); + code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset); + jump = jump->next; + } + if (const_ && const_->addr == word_count) { + const_->addr = (sljit_uw)code_ptr; + const_ = const_->next; + } + if (put_label && put_label->addr == word_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)(code_ptr - 3); + code_ptr -= put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size)); + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr ++; word_count ++; @@ -286,6 +317,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); jump = compiler->jumps; @@ -323,6 +355,23 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } + put_label = compiler->put_labels; + while (put_label) { + addr = put_label->label->addr; + buf_ptr = (sljit_ins *)put_label->addr; + + buf_ptr[0] |= (addr & 0xffff) << 5; + buf_ptr[1] |= ((addr >> 16) & 0xffff) << 5; + + if (put_label->flags >= 1) + buf_ptr[2] |= ((addr >> 32) & 0xffff) << 5; + + if (put_label->flags >= 2) + buf_ptr[3] |= ((addr >> 48) & 0xffff) << 5; + + put_label = put_label->next; + } + compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); @@ -1947,6 +1996,28 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi return const_; } +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1; + PTR_FAIL_IF(emit_imm64_const(compiler, dst_r, 0)); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 1); + + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2)); + + return put_label; +} + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) { sljit_ins* inst = (sljit_ins*)addr; diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c index d7024b6d7d..cdfe4a4d24 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeARM_T2_32.c @@ -365,11 +365,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_u16 *buf_ptr; sljit_u16 *buf_end; sljit_uw half_count; + sljit_uw next_addr; sljit_sw executable_offset; struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -381,34 +383,46 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; half_count = 0; + next_addr = 0; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; do { buf_ptr = (sljit_u16*)buf->memory; buf_end = buf_ptr + (buf->used_size >> 1); do { *code_ptr = *buf_ptr++; - /* These structures are ordered by their address. */ - SLJIT_ASSERT(!label || label->size >= half_count); - SLJIT_ASSERT(!jump || jump->addr >= half_count); - SLJIT_ASSERT(!const_ || const_->addr >= half_count); - if (label && label->size == half_count) { - label->addr = ((sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset)) | 0x1; - label->size = code_ptr - code; - label = label->next; - } - if (jump && jump->addr == half_count) { - jump->addr = (sljit_uw)code_ptr - ((jump->flags & IS_COND) ? 10 : 8); - code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset); - jump = jump->next; - } - if (const_ && const_->addr == half_count) { - const_->addr = (sljit_uw)code_ptr; - const_ = const_->next; + if (next_addr == half_count) { + SLJIT_ASSERT(!label || label->size >= half_count); + SLJIT_ASSERT(!jump || jump->addr >= half_count); + SLJIT_ASSERT(!const_ || const_->addr >= half_count); + SLJIT_ASSERT(!put_label || put_label->addr >= half_count); + + /* These structures are ordered by their address. */ + if (label && label->size == half_count) { + label->addr = ((sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset)) | 0x1; + label->size = code_ptr - code; + label = label->next; + } + if (jump && jump->addr == half_count) { + jump->addr = (sljit_uw)code_ptr - ((jump->flags & IS_COND) ? 10 : 8); + code_ptr -= detect_jump_type(jump, code_ptr, code, executable_offset); + jump = jump->next; + } + if (const_ && const_->addr == half_count) { + const_->addr = (sljit_uw)code_ptr; + const_ = const_->next; + } + if (put_label && put_label->addr == half_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr ++; half_count ++; @@ -426,6 +440,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); jump = compiler->jumps; @@ -434,6 +449,12 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } + put_label = compiler->put_labels; + while (put_label) { + modify_imm32_const((sljit_u16 *)put_label->addr, put_label->label->addr); + put_label = put_label->next; + } + compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; compiler->executable_size = (code_ptr - code) * sizeof(sljit_u16); @@ -2311,6 +2332,27 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi return const_; } +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); + + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1; + PTR_FAIL_IF(emit_imm32_const(compiler, dst_r, 0)); + + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE | STORE, dst_r, dst, dstw, TMP_REG2)); + return put_label; +} + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) { sljit_u16 *inst = (sljit_u16*)addr; diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_32.c index ad970bf25a..16dec052fe 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_32.c @@ -425,6 +425,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT((inst[0] & 0xffe00000) == LUI && (inst[1] & 0xfc000000) == ORI); inst[0] = (inst[0] & 0xffff0000) | ((new_target >> 16) & 0xffff); inst[1] = (inst[1] & 0xffff0000) | (new_target & 0xffff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); @@ -435,6 +436,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT((inst[0] & 0xffe00000) == LUI && (inst[1] & 0xfc000000) == ORI); inst[0] = (inst[0] & 0xffff0000) | ((new_constant >> 16) & 0xffff); inst[1] = (inst[1] & 0xffff0000) | (new_constant & 0xffff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_common.c b/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_common.c index e0d6a3f085..7d1d087496 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_common.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeMIPS_common.c @@ -449,6 +449,55 @@ static __attribute__ ((noinline)) void sljit_cache_flush(void* code, void* code_ } #endif +#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) + +static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label) +{ + if (max_label < 0x80000000l) { + put_label->flags = 0; + return 1; + } + + if (max_label < 0x800000000000l) { + put_label->flags = 1; + return 3; + } + + put_label->flags = 2; + return 5; +} + +static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label) +{ + sljit_uw addr = put_label->label->addr; + sljit_ins *inst = (sljit_ins *)put_label->addr; + sljit_s32 reg = *inst; + + if (put_label->flags == 0) { + SLJIT_ASSERT(addr < 0x80000000l); + inst[0] = LUI | T(reg) | IMM(addr >> 16); + } + else if (put_label->flags == 1) { + SLJIT_ASSERT(addr < 0x800000000000l); + inst[0] = LUI | T(reg) | IMM(addr >> 32); + inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff); + inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16); + inst += 2; + } + else { + inst[0] = LUI | T(reg) | IMM(addr >> 48); + inst[1] = ORI | S(reg) | T(reg) | IMM((addr >> 32) & 0xffff); + inst[2] = DSLL | T(reg) | D(reg) | SH_IMM(16); + inst[3] = ORI | S(reg) | T(reg) | IMM((addr >> 16) & 0xffff); + inst[4] = DSLL | T(reg) | D(reg) | SH_IMM(16); + inst += 4; + } + + inst[1] = ORI | S(reg) | T(reg) | IMM(addr & 0xffff); +} + +#endif + SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) { struct sljit_memory_fragment *buf; @@ -457,12 +506,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_ins *buf_ptr; sljit_ins *buf_end; sljit_uw word_count; + sljit_uw next_addr; sljit_sw executable_offset; sljit_uw addr; struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -474,39 +525,54 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; word_count = 0; + next_addr = 0; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; do { buf_ptr = (sljit_ins*)buf->memory; buf_end = buf_ptr + (buf->used_size >> 2); do { *code_ptr = *buf_ptr++; - SLJIT_ASSERT(!label || label->size >= word_count); - SLJIT_ASSERT(!jump || jump->addr >= word_count); - SLJIT_ASSERT(!const_ || const_->addr >= word_count); - /* These structures are ordered by their address. */ - if (label && label->size == word_count) { - label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); - label->size = code_ptr - code; - label = label->next; - } - if (jump && jump->addr == word_count) { + if (next_addr == word_count) { + SLJIT_ASSERT(!label || label->size >= word_count); + SLJIT_ASSERT(!jump || jump->addr >= word_count); + SLJIT_ASSERT(!const_ || const_->addr >= word_count); + SLJIT_ASSERT(!put_label || put_label->addr >= word_count); + + /* These structures are ordered by their address. */ + if (label && label->size == word_count) { + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); + label->size = code_ptr - code; + label = label->next; + } + if (jump && jump->addr == word_count) { #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) - jump->addr = (sljit_uw)(code_ptr - 3); + jump->addr = (sljit_uw)(code_ptr - 3); #else - jump->addr = (sljit_uw)(code_ptr - 7); + jump->addr = (sljit_uw)(code_ptr - 7); #endif - code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); - jump = jump->next; - } - if (const_ && const_->addr == word_count) { - /* Just recording the address. */ - const_->addr = (sljit_uw)code_ptr; - const_ = const_->next; + code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); + jump = jump->next; + } + if (const_ && const_->addr == word_count) { + const_->addr = (sljit_uw)code_ptr; + const_ = const_->next; + } + if (put_label && put_label->addr == word_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; +#if (defined SLJIT_CONFIG_MIPS_64 && SLJIT_CONFIG_MIPS_64) + code_ptr += put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size)); + word_count += 5; +#endif + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr ++; word_count ++; @@ -524,6 +590,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); jump = compiler->jumps; @@ -571,6 +638,21 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } + put_label = compiler->put_labels; + while (put_label) { +#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) + addr = put_label->label->addr; + buf_ptr = (sljit_ins *)put_label->addr; + + SLJIT_ASSERT((buf_ptr[0] & 0xffe00000) == LUI && (buf_ptr[1] & 0xfc000000) == ORI); + buf_ptr[0] |= (addr >> 16) & 0xffff; + buf_ptr[1] |= addr & 0xffff; +#else + put_label_set(put_label); +#endif + put_label = put_label->next; + } + compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); @@ -2157,7 +2239,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compil SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) { struct sljit_const *const_; - sljit_s32 reg; + sljit_s32 dst_r; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); @@ -2167,11 +2249,38 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi PTR_FAIL_IF(!const_); set_const(const_, compiler); - reg = FAST_IS_REG(dst) ? dst : TMP_REG2; - - PTR_FAIL_IF(emit_const(compiler, reg, init_value)); + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; + PTR_FAIL_IF(emit_const(compiler, dst_r, init_value)); if (dst & SLJIT_MEM) PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); + return const_; } + +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); + + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; +#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) + PTR_FAIL_IF(emit_const(compiler, dst_r, 0)); +#else + PTR_FAIL_IF(push_inst(compiler, dst_r, UNMOVABLE_INS)); + compiler->size += 5; +#endif + + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); + + return put_label; +} diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_32.c index fc185f7847..3ce741153f 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_32.c @@ -259,6 +259,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT((inst[0] & 0xfc1f0000) == ADDIS && (inst[1] & 0xfc000000) == ORI); inst[0] = (inst[0] & 0xffff0000) | ((new_target >> 16) & 0xffff); inst[1] = (inst[1] & 0xffff0000) | (new_target & 0xffff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); @@ -269,6 +270,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT((inst[0] & 0xfc1f0000) == ADDIS && (inst[1] & 0xfc000000) == ORI); inst[0] = (inst[0] & 0xffff0000) | ((new_constant >> 16) & 0xffff); inst[1] = (inst[1] & 0xffff0000) | (new_constant & 0xffff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_64.c b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_64.c index 706b2ba20b..3b73021cc8 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_64.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_64.c @@ -35,9 +35,6 @@ #error "Must implement count leading zeroes" #endif -#define RLDI(dst, src, sh, mb, type) \ - (HI(30) | S(src) | A(dst) | ((type) << 2) | (((sh) & 0x1f) << 11) | (((sh) & 0x20) >> 4) | (((mb) & 0x1f) << 6) | ((mb) & 0x20)) - #define PUSH_RLDICR(reg, shift) \ push_inst(compiler, RLDI(reg, reg, 63 - shift, shift, 1)) diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_common.c b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_common.c index b34e3965ed..e827514315 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativePPC_common.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativePPC_common.c @@ -231,6 +231,9 @@ static const sljit_u8 freg_map[SLJIT_NUMBER_OF_FLOAT_REGISTERS + 3] = { #define SIMM_MIN (-0x8000) #define UIMM_MAX (0xffff) +#define RLDI(dst, src, sh, mb, type) \ + (HI(30) | S(src) | A(dst) | ((type) << 2) | (((sh) & 0x1f) << 11) | (((sh) & 0x20) >> 4) | (((mb) & 0x1f) << 6) | ((mb) & 0x20)) + #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) SLJIT_API_FUNC_ATTRIBUTE void sljit_set_function_context(void** func_ptr, struct sljit_function_context* context, sljit_sw addr, void* func) { @@ -324,6 +327,55 @@ keep_address: return 0; } +#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) + +static SLJIT_INLINE sljit_sw put_label_get_length(struct sljit_put_label *put_label, sljit_uw max_label) +{ + if (max_label < 0x100000000l) { + put_label->flags = 0; + return 1; + } + + if (max_label < 0x1000000000000l) { + put_label->flags = 1; + return 3; + } + + put_label->flags = 2; + return 4; +} + +static SLJIT_INLINE void put_label_set(struct sljit_put_label *put_label) +{ + sljit_uw addr = put_label->label->addr; + sljit_ins *inst = (sljit_ins *)put_label->addr; + sljit_s32 reg = *inst; + + if (put_label->flags == 0) { + SLJIT_ASSERT(addr < 0x100000000l); + inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 16); + } + else { + if (put_label->flags == 1) { + SLJIT_ASSERT(addr < 0x1000000000000l); + inst[0] = ORI | S(TMP_ZERO) | A(reg) | IMM(addr >> 32); + } + else { + inst[0] = ORIS | S(TMP_ZERO) | A(reg) | IMM(addr >> 48); + inst[1] = ORI | S(reg) | A(reg) | IMM((addr >> 32) & 0xffff); + inst ++; + } + + inst[1] = RLDI(reg, reg, 32, 31, 1); + inst[2] = ORIS | S(reg) | A(reg) | IMM((addr >> 16) & 0xffff); + inst += 2; + } + + inst[1] = ORI | S(reg) | A(reg) | IMM(addr & 0xffff); +} + +#endif + SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) { struct sljit_memory_fragment *buf; @@ -332,12 +384,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_ins *buf_ptr; sljit_ins *buf_end; sljit_uw word_count; + sljit_uw next_addr; sljit_sw executable_offset; sljit_uw addr; struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -356,71 +410,87 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; word_count = 0; + next_addr = 0; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; do { buf_ptr = (sljit_ins*)buf->memory; buf_end = buf_ptr + (buf->used_size >> 2); do { *code_ptr = *buf_ptr++; - SLJIT_ASSERT(!label || label->size >= word_count); - SLJIT_ASSERT(!jump || jump->addr >= word_count); - SLJIT_ASSERT(!const_ || const_->addr >= word_count); - /* These structures are ordered by their address. */ - if (label && label->size == word_count) { - /* Just recording the address. */ - label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); - label->size = code_ptr - code; - label = label->next; - } - if (jump && jump->addr == word_count) { + if (next_addr == word_count) { + SLJIT_ASSERT(!label || label->size >= word_count); + SLJIT_ASSERT(!jump || jump->addr >= word_count); + SLJIT_ASSERT(!const_ || const_->addr >= word_count); + SLJIT_ASSERT(!put_label || put_label->addr >= word_count); + + /* These structures are ordered by their address. */ + if (label && label->size == word_count) { + /* Just recording the address. */ + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); + label->size = code_ptr - code; + label = label->next; + } + if (jump && jump->addr == word_count) { #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) - jump->addr = (sljit_uw)(code_ptr - 3); + jump->addr = (sljit_uw)(code_ptr - 3); #else - jump->addr = (sljit_uw)(code_ptr - 6); + jump->addr = (sljit_uw)(code_ptr - 6); #endif - if (detect_jump_type(jump, code_ptr, code, executable_offset)) { + if (detect_jump_type(jump, code_ptr, code, executable_offset)) { #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) - code_ptr[-3] = code_ptr[0]; - code_ptr -= 3; -#else - if (jump->flags & PATCH_ABS32) { + code_ptr[-3] = code_ptr[0]; code_ptr -= 3; - code_ptr[-1] = code_ptr[2]; - code_ptr[0] = code_ptr[3]; - } - else if (jump->flags & PATCH_ABS48) { - code_ptr--; - code_ptr[-1] = code_ptr[0]; - code_ptr[0] = code_ptr[1]; - /* rldicr rX,rX,32,31 -> rX,rX,16,47 */ - SLJIT_ASSERT((code_ptr[-3] & 0xfc00ffff) == 0x780007c6); - code_ptr[-3] ^= 0x8422; - /* oris -> ori */ - code_ptr[-2] ^= 0x4000000; - } - else { - code_ptr[-6] = code_ptr[0]; - code_ptr -= 6; - } +#else + if (jump->flags & PATCH_ABS32) { + code_ptr -= 3; + code_ptr[-1] = code_ptr[2]; + code_ptr[0] = code_ptr[3]; + } + else if (jump->flags & PATCH_ABS48) { + code_ptr--; + code_ptr[-1] = code_ptr[0]; + code_ptr[0] = code_ptr[1]; + /* rldicr rX,rX,32,31 -> rX,rX,16,47 */ + SLJIT_ASSERT((code_ptr[-3] & 0xfc00ffff) == 0x780007c6); + code_ptr[-3] ^= 0x8422; + /* oris -> ori */ + code_ptr[-2] ^= 0x4000000; + } + else { + code_ptr[-6] = code_ptr[0]; + code_ptr -= 6; + } #endif - if (jump->flags & REMOVE_COND) { - code_ptr[0] = BCx | (2 << 2) | ((code_ptr[0] ^ (8 << 21)) & 0x03ff0001); - code_ptr++; - jump->addr += sizeof(sljit_ins); - code_ptr[0] = Bx; - jump->flags -= IS_COND; + if (jump->flags & REMOVE_COND) { + code_ptr[0] = BCx | (2 << 2) | ((code_ptr[0] ^ (8 << 21)) & 0x03ff0001); + code_ptr++; + jump->addr += sizeof(sljit_ins); + code_ptr[0] = Bx; + jump->flags -= IS_COND; + } } + jump = jump->next; } - jump = jump->next; - } - if (const_ && const_->addr == word_count) { - const_->addr = (sljit_uw)code_ptr; - const_ = const_->next; + if (const_ && const_->addr == word_count) { + const_->addr = (sljit_uw)code_ptr; + const_ = const_->next; + } + if (put_label && put_label->addr == word_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; +#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64) + code_ptr += put_label_get_length(put_label, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size)); + word_count += 4; +#endif + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr ++; word_count ++; @@ -438,6 +508,8 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); + #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL) SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size - (sizeof(struct sljit_function_context) / sizeof(sljit_ins))); #else @@ -503,6 +575,21 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } + put_label = compiler->put_labels; + while (put_label) { +#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) + addr = put_label->label->addr; + buf_ptr = (sljit_ins *)put_label->addr; + + SLJIT_ASSERT((buf_ptr[0] & 0xfc1f0000) == ADDIS && (buf_ptr[1] & 0xfc000000) == ORI); + buf_ptr[0] |= (addr >> 16) & 0xffff; + buf_ptr[1] |= addr & 0xffff; +#else + put_label_set(put_label); +#endif + put_label = put_label->next; + } + compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); @@ -2261,7 +2348,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fmem(struct sljit_compiler *compil SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) { struct sljit_const *const_; - sljit_s32 reg; + sljit_s32 dst_r; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); @@ -2271,11 +2358,38 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi PTR_FAIL_IF(!const_); set_const(const_, compiler); - reg = FAST_IS_REG(dst) ? dst : TMP_REG2; - - PTR_FAIL_IF(emit_const(compiler, reg, init_value)); + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; + PTR_FAIL_IF(emit_const(compiler, dst_r, init_value)); if (dst & SLJIT_MEM) PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); + return const_; } + +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); + + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; +#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) + PTR_FAIL_IF(emit_const(compiler, dst_r, 0)); +#else + PTR_FAIL_IF(push_inst(compiler, dst_r)); + compiler->size += 4; +#endif + + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); + + return put_label; +} diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_32.c index 0671b130cc..8079fad8df 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_32.c @@ -267,6 +267,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_ta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT(((inst[0] & 0xc1c00000) == 0x01000000) && ((inst[1] & 0xc1f82000) == 0x80102000)); inst[0] = (inst[0] & 0xffc00000) | ((new_target >> 10) & 0x3fffff); inst[1] = (inst[1] & 0xfffffc00) | (new_target & 0x3ff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); @@ -277,6 +278,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_sw new_consta { sljit_ins *inst = (sljit_ins *)addr; + SLJIT_ASSERT(((inst[0] & 0xc1c00000) == 0x01000000) && ((inst[1] & 0xc1f82000) == 0x80102000)); inst[0] = (inst[0] & 0xffc00000) | ((new_constant >> 10) & 0x3fffff); inst[1] = (inst[1] & 0xfffffc00) | (new_constant & 0x3ff); inst = (sljit_ins *)SLJIT_ADD_EXEC_OFFSET(inst, executable_offset); diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_common.c b/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_common.c index 669ecd8152..bfa4ecede2 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_common.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeSPARC_common.c @@ -298,12 +298,14 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil sljit_ins *buf_ptr; sljit_ins *buf_end; sljit_uw word_count; + sljit_uw next_addr; sljit_sw executable_offset; sljit_uw addr; struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -315,40 +317,52 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil code_ptr = code; word_count = 0; + next_addr = 0; executable_offset = SLJIT_EXEC_OFFSET(code); label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; do { buf_ptr = (sljit_ins*)buf->memory; buf_end = buf_ptr + (buf->used_size >> 2); do { *code_ptr = *buf_ptr++; - SLJIT_ASSERT(!label || label->size >= word_count); - SLJIT_ASSERT(!jump || jump->addr >= word_count); - SLJIT_ASSERT(!const_ || const_->addr >= word_count); - /* These structures are ordered by their address. */ - if (label && label->size == word_count) { - /* Just recording the address. */ - label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); - label->size = code_ptr - code; - label = label->next; - } - if (jump && jump->addr == word_count) { + if (next_addr == word_count) { + SLJIT_ASSERT(!label || label->size >= word_count); + SLJIT_ASSERT(!jump || jump->addr >= word_count); + SLJIT_ASSERT(!const_ || const_->addr >= word_count); + SLJIT_ASSERT(!put_label || put_label->addr >= word_count); + + /* These structures are ordered by their address. */ + if (label && label->size == word_count) { + /* Just recording the address. */ + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); + label->size = code_ptr - code; + label = label->next; + } + if (jump && jump->addr == word_count) { #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) - jump->addr = (sljit_uw)(code_ptr - 3); + jump->addr = (sljit_uw)(code_ptr - 3); #else - jump->addr = (sljit_uw)(code_ptr - 6); + jump->addr = (sljit_uw)(code_ptr - 6); #endif - code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); - jump = jump->next; - } - if (const_ && const_->addr == word_count) { - /* Just recording the address. */ - const_->addr = (sljit_uw)code_ptr; - const_ = const_->next; + code_ptr = detect_jump_type(jump, code_ptr, code, executable_offset); + jump = jump->next; + } + if (const_ && const_->addr == word_count) { + /* Just recording the address. */ + const_->addr = (sljit_uw)code_ptr; + const_ = const_->next; + } + if (put_label && put_label->addr == word_count) { + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; + put_label = put_label->next; + } + next_addr = compute_next_addr(label, jump, const_, put_label); } code_ptr ++; word_count ++; @@ -366,6 +380,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); SLJIT_ASSERT(code_ptr - code <= (sljit_s32)compiler->size); jump = compiler->jumps; @@ -389,8 +404,9 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil /* Set the fields of immediate loads. */ #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) - buf_ptr[0] = (buf_ptr[0] & 0xffc00000) | ((addr >> 10) & 0x3fffff); - buf_ptr[1] = (buf_ptr[1] & 0xfffffc00) | (addr & 0x3ff); + SLJIT_ASSERT(((buf_ptr[0] & 0xc1cfffff) == 0x01000000) && ((buf_ptr[1] & 0xc1f83fff) == 0x80102000)); + buf_ptr[0] |= (addr >> 10) & 0x3fffff; + buf_ptr[1] |= addr & 0x3ff; #else #error "Implementation required" #endif @@ -398,6 +414,20 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } + put_label = compiler->put_labels; + while (put_label) { + addr = put_label->label->addr; + buf_ptr = (sljit_ins *)put_label->addr; + +#if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32) + SLJIT_ASSERT(((buf_ptr[0] & 0xc1cfffff) == 0x01000000) && ((buf_ptr[1] & 0xc1f83fff) == 0x80102000)); + buf_ptr[0] |= (addr >> 10) & 0x3fffff; + buf_ptr[1] |= addr & 0x3ff; +#else +#error "Implementation required" +#endif + put_label = put_label->next; + } compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; @@ -1465,8 +1495,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compil SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value) { - sljit_s32 reg; struct sljit_const *const_; + sljit_s32 dst_r; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); @@ -1476,11 +1506,31 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi PTR_FAIL_IF(!const_); set_const(const_, compiler); - reg = FAST_IS_REG(dst) ? dst : TMP_REG2; - - PTR_FAIL_IF(emit_const(compiler, reg, init_value)); + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; + PTR_FAIL_IF(emit_const(compiler, dst_r, init_value)); if (dst & SLJIT_MEM) PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); return const_; } + +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_s32 dst_r; + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); + + dst_r = FAST_IS_REG(dst) ? dst : TMP_REG2; + PTR_FAIL_IF(emit_const(compiler, dst_r, 0)); + + if (dst & SLJIT_MEM) + PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw)); + return put_label; +} diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_32.c b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_32.c index 074e64b9f2..34a3a3d940 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_32.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_32.c @@ -38,8 +38,10 @@ static sljit_s32 emit_do_imm(struct sljit_compiler *compiler, sljit_u8 opcode, s return SLJIT_SUCCESS; } -static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type, sljit_sw executable_offset) +static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_sw executable_offset) { + sljit_s32 type = jump->flags >> TYPE_SHIFT; + if (type == SLJIT_JUMP) { *code_ptr++ = JMP_i32; jump->addr++; diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_64.c b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_64.c index 8506565614..5758711954 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_64.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_64.c @@ -39,8 +39,10 @@ static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg, return SLJIT_SUCCESS; } -static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type) +static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr) { + sljit_s32 type = jump->flags >> TYPE_SHIFT; + int short_addr = !(jump->flags & SLJIT_REWRITABLE_JUMP) && !(jump->flags & JUMP_LABEL) && (jump->u.target <= 0xffffffff); /* The relative jump below specialized for this case. */ @@ -72,6 +74,56 @@ static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ return code_ptr; } +static sljit_u8* generate_put_label_code(struct sljit_put_label *put_label, sljit_u8 *code_ptr, sljit_uw max_label) +{ + if (max_label > HALFWORD_MAX) { + put_label->addr -= put_label->flags; + put_label->flags = PATCH_MD; + return code_ptr; + } + + if (put_label->flags == 0) { + /* Destination is register. */ + code_ptr = (sljit_u8*)put_label->addr - 2 - sizeof(sljit_uw); + + SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W); + SLJIT_ASSERT((code_ptr[1] & 0xf8) == MOV_r_i32); + + if ((code_ptr[0] & 0x07) != 0) { + code_ptr[0] = (sljit_u8)(code_ptr[0] & ~0x08); + code_ptr += 2 + sizeof(sljit_s32); + } + else { + code_ptr[0] = code_ptr[1]; + code_ptr += 1 + sizeof(sljit_s32); + } + + put_label->addr = (sljit_uw)code_ptr; + return code_ptr; + } + + code_ptr -= put_label->flags + (2 + sizeof(sljit_uw)); + SLJIT_MEMMOVE(code_ptr, code_ptr + (2 + sizeof(sljit_uw)), put_label->flags); + + SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W); + + if ((code_ptr[1] & 0xf8) == MOV_r_i32) { + code_ptr += 2 + sizeof(sljit_uw); + SLJIT_ASSERT((code_ptr[0] & 0xf8) == REX_W); + } + + SLJIT_ASSERT(code_ptr[1] == MOV_rm_r); + + code_ptr[0] = (sljit_u8)(code_ptr[0] & ~0x4); + code_ptr[1] = MOV_rm_i32; + code_ptr[2] = (sljit_u8)(code_ptr[2] & ~(0x7 << 3)); + + code_ptr = (sljit_u8*)(put_label->addr - (2 + sizeof(sljit_uw)) + sizeof(sljit_s32)); + put_label->addr = (sljit_uw)code_ptr; + put_label->flags = 0; + return code_ptr; +} + SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, sljit_s32 options, sljit_s32 arg_types, sljit_s32 scratches, sljit_s32 saveds, sljit_s32 fscratches, sljit_s32 fsaveds, sljit_s32 local_size) diff --git a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_common.c b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_common.c index 6f02ee3e8b..6296da5382 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitNativeX86_common.c +++ b/src/3rdparty/pcre2/src/sljit/sljitNativeX86_common.c @@ -428,13 +428,15 @@ static sljit_u8 get_jump_code(sljit_s32 type) } #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) -static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type, sljit_sw executable_offset); +static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_sw executable_offset); #else -static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_s32 type); +static sljit_u8* generate_far_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr); +static sljit_u8* generate_put_label_code(struct sljit_put_label *put_label, sljit_u8 *code_ptr, sljit_uw max_label); #endif -static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_u8 *code, sljit_s32 type, sljit_sw executable_offset) +static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code_ptr, sljit_u8 *code, sljit_sw executable_offset) { + sljit_s32 type = jump->flags >> TYPE_SHIFT; sljit_s32 short_jump; sljit_uw label_addr; @@ -447,7 +449,7 @@ static sljit_u8* generate_near_jump_code(struct sljit_jump *jump, sljit_u8 *code #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) if ((sljit_sw)(label_addr - (jump->addr + 1)) > HALFWORD_MAX || (sljit_sw)(label_addr - (jump->addr + 1)) < HALFWORD_MIN) - return generate_far_jump_code(jump, code_ptr, type); + return generate_far_jump_code(jump, code_ptr); #endif if (type == SLJIT_JUMP) { @@ -497,6 +499,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil struct sljit_label *label; struct sljit_jump *jump; struct sljit_const *const_; + struct sljit_put_label *put_label; CHECK_ERROR_PTR(); CHECK_PTR(check_sljit_generate_code(compiler)); @@ -511,6 +514,7 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil label = compiler->labels; jump = compiler->jumps; const_ = compiler->consts; + put_label = compiler->put_labels; executable_offset = SLJIT_EXEC_OFFSET(code); do { @@ -525,27 +529,38 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil buf_ptr += len; } else { - if (*buf_ptr >= 2) { + switch (*buf_ptr) { + case 0: + label->addr = (sljit_uw)SLJIT_ADD_EXEC_OFFSET(code_ptr, executable_offset); + label->size = code_ptr - code; + label = label->next; + break; + case 1: jump->addr = (sljit_uw)code_ptr; if (!(jump->flags & SLJIT_REWRITABLE_JUMP)) - code_ptr = generate_near_jump_code(jump, code_ptr, code, *buf_ptr - 2, executable_offset); + code_ptr = generate_near_jump_code(jump, code_ptr, code, executable_offset); else { #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) - code_ptr = generate_far_jump_code(jump, code_ptr, *buf_ptr - 2, executable_offset); + code_ptr = generate_far_jump_code(jump, code_ptr, executable_offset); #else - code_ptr = generate_far_jump_code(jump, code_ptr, *buf_ptr - 2); + code_ptr = generate_far_jump_code(jump, code_ptr); #endif } jump = jump->next; - } - else if (*buf_ptr == 0) { - label->addr = ((sljit_uw)code_ptr) + executable_offset; - label->size = code_ptr - code; - label = label->next; - } - else { /* *buf_ptr is 1 */ + break; + case 2: const_->addr = ((sljit_uw)code_ptr) - sizeof(sljit_sw); const_ = const_->next; + break; + default: + SLJIT_ASSERT(*buf_ptr == 3); + SLJIT_ASSERT(put_label->label); + put_label->addr = (sljit_uw)code_ptr; +#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) + code_ptr = generate_put_label_code(put_label, code_ptr, (sljit_uw)(SLJIT_ADD_EXEC_OFFSET(code, executable_offset) + put_label->label->size)); +#endif + put_label = put_label->next; + break; } buf_ptr++; } @@ -557,6 +572,8 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil SLJIT_ASSERT(!label); SLJIT_ASSERT(!jump); SLJIT_ASSERT(!const_); + SLJIT_ASSERT(!put_label); + SLJIT_ASSERT(code_ptr <= code + compiler->size); jump = compiler->jumps; while (jump) { @@ -591,8 +608,24 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil jump = jump->next; } - /* Some space may be wasted because of short jumps. */ - SLJIT_ASSERT(code_ptr <= code + compiler->size); + put_label = compiler->put_labels; + while (put_label) { +#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) + sljit_unaligned_store_sw((void*)(put_label->addr - sizeof(sljit_sw)), (sljit_sw)put_label->label->addr); +#else + if (put_label->flags & PATCH_MD) { + SLJIT_ASSERT(put_label->label->addr > HALFWORD_MAX); + sljit_unaligned_store_sw((void*)(put_label->addr - sizeof(sljit_sw)), (sljit_sw)put_label->label->addr); + } + else { + SLJIT_ASSERT(put_label->label->addr <= HALFWORD_MAX); + sljit_unaligned_store_s32((void*)(put_label->addr - sizeof(sljit_s32)), (sljit_s32)put_label->label->addr); + } +#endif + + put_label = put_label->next; + } + compiler->error = SLJIT_ERR_COMPILED; compiler->executable_offset = executable_offset; compiler->executable_size = code_ptr - code; @@ -2481,7 +2514,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); PTR_FAIL_IF_NULL(jump); - set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); + set_jump(jump, compiler, (type & SLJIT_REWRITABLE_JUMP) | ((type & 0xff) << TYPE_SHIFT)); type &= 0xff; /* Worst case size. */ @@ -2495,7 +2528,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compile PTR_FAIL_IF_NULL(inst); *inst++ = 0; - *inst++ = type + 2; + *inst++ = 1; return jump; } @@ -2513,7 +2546,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi if (src == SLJIT_IMM) { jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); FAIL_IF_NULL(jump); - set_jump(jump, compiler, JUMP_ADDR); + set_jump(jump, compiler, JUMP_ADDR | (type << TYPE_SHIFT)); jump->u.target = srcw; /* Worst case size. */ @@ -2527,7 +2560,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compi FAIL_IF_NULL(inst); *inst++ = 0; - *inst++ = type + 2; + *inst++ = 1; } else { #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) @@ -2831,7 +2864,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi PTR_FAIL_IF(!inst); *inst++ = 0; - *inst++ = 1; + *inst++ = 2; #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) if (dst & SLJIT_MEM) @@ -2842,6 +2875,54 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi return const_; } +SLJIT_API_FUNC_ATTRIBUTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw) +{ + struct sljit_put_label *put_label; + sljit_u8 *inst; +#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) + sljit_s32 reg; + sljit_uw start_size; +#endif + + CHECK_ERROR_PTR(); + CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); + ADJUST_LOCAL_OFFSET(dst, dstw); + + CHECK_EXTRA_REGS(dst, dstw, (void)0); + + put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); + PTR_FAIL_IF(!put_label); + set_put_label(put_label, compiler, 0); + +#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) + compiler->mode32 = 0; + reg = FAST_IS_REG(dst) ? dst : TMP_REG1; + + if (emit_load_imm64(compiler, reg, 0)) + return NULL; +#else + if (emit_mov(compiler, dst, dstw, SLJIT_IMM, 0)) + return NULL; +#endif + +#if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) + if (dst & SLJIT_MEM) { + start_size = compiler->size; + if (emit_mov(compiler, dst, dstw, TMP_REG1, 0)) + return NULL; + put_label->flags = compiler->size - start_size; + } +#endif + + inst = (sljit_u8*)ensure_buf(compiler, 2); + PTR_FAIL_IF(!inst); + + *inst++ = 0; + *inst++ = 3; + + return put_label; +} + SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_target, sljit_sw executable_offset) { SLJIT_UNUSED_ARG(executable_offset); diff --git a/src/3rdparty/pcre2/src/sljit/sljitUtils.c b/src/3rdparty/pcre2/src/sljit/sljitUtils.c index 2ead044b1b..39f6a44b24 100644 --- a/src/3rdparty/pcre2/src/sljit/sljitUtils.c +++ b/src/3rdparty/pcre2/src/sljit/sljitUtils.c @@ -154,7 +154,13 @@ SLJIT_API_FUNC_ATTRIBUTE void SLJIT_FUNC sljit_release_lock(void) #include "windows.h" #else /* Provides mmap function. */ +#include #include +#ifndef MAP_ANON +#ifdef MAP_ANONYMOUS +#define MAP_ANON MAP_ANONYMOUS +#endif +#endif /* For detecting the page size. */ #include -- cgit v1.2.3 From 6e3b4ddd9256801dc7d0c245808e81dc669b1f2f Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 23 Nov 2019 15:05:35 +0100 Subject: QRegularExpression: adjust the error codes matching PCRE2 10.34 Change-Id: I78ecda1bdc784b8d7a69a4927dbe3b0f08c1d907 Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- src/corelib/text/qregularexpression.cpp | 65 ++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index a02d471134..8627cbba4f 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -2867,7 +2867,7 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "numbers out of order in {} quantifier"), QT_TRANSLATE_NOOP("QRegularExpression", "number too big in {} quantifier"), QT_TRANSLATE_NOOP("QRegularExpression", "missing terminating ] for character class"), - QT_TRANSLATE_NOOP("QRegularExpression", "invalid escape sequence in character class"), + QT_TRANSLATE_NOOP("QRegularExpression", "escape sequence is invalid in character class"), QT_TRANSLATE_NOOP("QRegularExpression", "range out of order in character class"), QT_TRANSLATE_NOOP("QRegularExpression", "quantifier does not follow a repeatable item"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unexpected repeat"), @@ -2884,46 +2884,46 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "failed to allocate heap memory"), QT_TRANSLATE_NOOP("QRegularExpression", "unmatched closing parenthesis"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: code overflow"), - QT_TRANSLATE_NOOP("QRegularExpression", "letter or underscore expected after (?< or (?'"), + QT_TRANSLATE_NOOP("QRegularExpression", "missing closing parenthesis for condition"), QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind assertion is not fixed length"), - QT_TRANSLATE_NOOP("QRegularExpression", "malformed number or name after (?("), - QT_TRANSLATE_NOOP("QRegularExpression", "conditional group contains more than two branches"), + QT_TRANSLATE_NOOP("QRegularExpression", "a relative value of zero is not allowed"), + QT_TRANSLATE_NOOP("QRegularExpression", "conditional subpattern contains more than two branches"), QT_TRANSLATE_NOOP("QRegularExpression", "assertion expected after (?( or (?(?C)"), - QT_TRANSLATE_NOOP("QRegularExpression", "(?R or (?[+-]digits must be followed by )"), + QT_TRANSLATE_NOOP("QRegularExpression", "digit expected after (?+ or (?-"), QT_TRANSLATE_NOOP("QRegularExpression", "unknown POSIX class name"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error in pcre2_study(): should not occur"), QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE2 does not have Unicode support"), QT_TRANSLATE_NOOP("QRegularExpression", "parentheses are too deeply nested (stack check)"), QT_TRANSLATE_NOOP("QRegularExpression", "character code point value in \\x{} or \\o{} is too large"), - QT_TRANSLATE_NOOP("QRegularExpression", "invalid condition (?(0)"), - QT_TRANSLATE_NOOP("QRegularExpression", "\\C is not allowed in a lookbehind assertion"), - QT_TRANSLATE_NOOP("QRegularExpression", "PCRE does not support \\L, \\l, \\N{name}, \\U, or \\u"), + QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind is too complicated"), + QT_TRANSLATE_NOOP("QRegularExpression", "\\C is not allowed in a lookbehind assertion in UTF-" "16" " mode"), + QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2 does not support \\F, \\L, \\l, \\N{name}, \\U, or \\u"), QT_TRANSLATE_NOOP("QRegularExpression", "number after (?C is greater than 255"), QT_TRANSLATE_NOOP("QRegularExpression", "closing parenthesis for (?C expected"), QT_TRANSLATE_NOOP("QRegularExpression", "invalid escape sequence in (*VERB) name"), QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized character after (?P"), - QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in subpattern name (missing terminator)"), + QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in subpattern name (missing terminator?)"), QT_TRANSLATE_NOOP("QRegularExpression", "two named subpatterns have the same name (PCRE2_DUPNAMES not set)"), - QT_TRANSLATE_NOOP("QRegularExpression", "group name must start with a non-digit"), + QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name must start with a non-digit"), QT_TRANSLATE_NOOP("QRegularExpression", "this version of PCRE2 does not have support for \\P, \\p, or \\X"), QT_TRANSLATE_NOOP("QRegularExpression", "malformed \\P or \\p sequence"), QT_TRANSLATE_NOOP("QRegularExpression", "unknown property name after \\P or \\p"), - QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name is too long (maximum " "10000" " characters)"), - QT_TRANSLATE_NOOP("QRegularExpression", "too many named subpatterns (maximum " "256" ")"), + QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name is too long (maximum " "32" " code units)"), + QT_TRANSLATE_NOOP("QRegularExpression", "too many named subpatterns (maximum " "10000" ")"), QT_TRANSLATE_NOOP("QRegularExpression", "invalid range in character class"), QT_TRANSLATE_NOOP("QRegularExpression", "octal value is greater than \\377 in 8-bit non-UTF-8 mode"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: overran compiling workspace"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: previously-checked referenced subpattern not found"), - QT_TRANSLATE_NOOP("QRegularExpression", "DEFINE group contains more than one branch"), + QT_TRANSLATE_NOOP("QRegularExpression", "DEFINE subpattern contains more than one branch"), QT_TRANSLATE_NOOP("QRegularExpression", "missing opening brace after \\o"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown newline setting"), QT_TRANSLATE_NOOP("QRegularExpression", "\\g is not followed by a braced, angle-bracketed, or quoted name/number or by a plain number"), - QT_TRANSLATE_NOOP("QRegularExpression", "a numbered reference must not be zero"), - QT_TRANSLATE_NOOP("QRegularExpression", "an argument is not allowed for (*ACCEPT), (*FAIL), or (*COMMIT)"), + QT_TRANSLATE_NOOP("QRegularExpression", "(?R (recursive pattern call) must be followed by a closing parenthesis"), + QT_TRANSLATE_NOOP("QRegularExpression", "obsolete error (should not occur)"), QT_TRANSLATE_NOOP("QRegularExpression", "(*VERB) not recognized or malformed"), - QT_TRANSLATE_NOOP("QRegularExpression", "number is too big"), + QT_TRANSLATE_NOOP("QRegularExpression", "subpattern number is too big"), QT_TRANSLATE_NOOP("QRegularExpression", "subpattern name expected"), - QT_TRANSLATE_NOOP("QRegularExpression", "digit expected after (?+"), + QT_TRANSLATE_NOOP("QRegularExpression", "internal error: parsed pattern overflow"), QT_TRANSLATE_NOOP("QRegularExpression", "non-octal character in \\o{} (closing brace missing?)"), QT_TRANSLATE_NOOP("QRegularExpression", "different names for subpatterns of the same number are not allowed"), QT_TRANSLATE_NOOP("QRegularExpression", "(*MARK) must have an argument"), @@ -2931,16 +2931,16 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "\\c must be followed by a printable ASCII character"), QT_TRANSLATE_NOOP("QRegularExpression", "\\c must be followed by a letter or one of [\\]^_?"), QT_TRANSLATE_NOOP("QRegularExpression", "\\k is not followed by a braced, angle-bracketed, or quoted name"), - QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown opcode in find_fixedlength()"), + QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown meta code in check_lookbehinds()"), QT_TRANSLATE_NOOP("QRegularExpression", "\\N is not supported in a class"), - QT_TRANSLATE_NOOP("QRegularExpression", "SPARE ERROR"), + QT_TRANSLATE_NOOP("QRegularExpression", "callout string is too long"), QT_TRANSLATE_NOOP("QRegularExpression", "disallowed Unicode code point (>= 0xd800 && <= 0xdfff)"), QT_TRANSLATE_NOOP("QRegularExpression", "using UTF is disabled by the application"), QT_TRANSLATE_NOOP("QRegularExpression", "using UCP is disabled by the application"), QT_TRANSLATE_NOOP("QRegularExpression", "name is too long in (*MARK), (*PRUNE), (*SKIP), or (*THEN)"), QT_TRANSLATE_NOOP("QRegularExpression", "character code point value in \\u.... sequence is too large"), - QT_TRANSLATE_NOOP("QRegularExpression", "digits missing in \\x{} or \\o{}"), - QT_TRANSLATE_NOOP("QRegularExpression", "syntax error in (?(VERSION condition"), + QT_TRANSLATE_NOOP("QRegularExpression", "digits missing in \\x{} or \\o{} or \\N{U+}"), + QT_TRANSLATE_NOOP("QRegularExpression", "syntax error or number too big in (?(VERSION condition"), QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown opcode in auto_possessify()"), QT_TRANSLATE_NOOP("QRegularExpression", "missing terminating delimiter for callout with string argument"), QT_TRANSLATE_NOOP("QRegularExpression", "unrecognized string delimiter follows (?C"), @@ -2950,6 +2950,16 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "regular expression is too complicated"), QT_TRANSLATE_NOOP("QRegularExpression", "lookbehind assertion is too long"), QT_TRANSLATE_NOOP("QRegularExpression", "pattern string is longer than the limit set by the application"), + QT_TRANSLATE_NOOP("QRegularExpression", "internal error: unknown code in parsed pattern"), + QT_TRANSLATE_NOOP("QRegularExpression", "internal error: bad code value in parsed_skip()"), + QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is not allowed in UTF-16 mode"), + QT_TRANSLATE_NOOP("QRegularExpression", "invalid option bits with PCRE2_LITERAL"), + QT_TRANSLATE_NOOP("QRegularExpression", "\\N{U+dddd} is supported only in Unicode (UTF) mode"), + QT_TRANSLATE_NOOP("QRegularExpression", "invalid hyphen in option setting"), + QT_TRANSLATE_NOOP("QRegularExpression", "(*alpha_assertion) not recognized"), + QT_TRANSLATE_NOOP("QRegularExpression", "script runs require Unicode support, which this version of PCRE2 does not have"), + QT_TRANSLATE_NOOP("QRegularExpression", "too many capturing groups (maximum 65535)"), + QT_TRANSLATE_NOOP("QRegularExpression", "atomic assertion expected after (?( or (?(?C)"), QT_TRANSLATE_NOOP("QRegularExpression", "no error"), QT_TRANSLATE_NOOP("QRegularExpression", "no match"), QT_TRANSLATE_NOOP("QRegularExpression", "partial match"), @@ -2987,7 +2997,7 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "bad option value"), QT_TRANSLATE_NOOP("QRegularExpression", "invalid replacement string"), QT_TRANSLATE_NOOP("QRegularExpression", "bad offset into UTF string"), - QT_TRANSLATE_NOOP("QRegularExpression", "callout error code"), /* Never returned by PCRE2 itself */ + QT_TRANSLATE_NOOP("QRegularExpression", "callout error code"), QT_TRANSLATE_NOOP("QRegularExpression", "invalid data in workspace for DFA restart"), QT_TRANSLATE_NOOP("QRegularExpression", "too much recursion for DFA matching"), QT_TRANSLATE_NOOP("QRegularExpression", "backreference condition or recursion test is not supported for DFA matching"), @@ -3003,15 +3013,20 @@ static const char *pcreCompileErrorCodes[] = QT_TRANSLATE_NOOP("QRegularExpression", "non-unique substring name"), QT_TRANSLATE_NOOP("QRegularExpression", "NULL argument passed"), QT_TRANSLATE_NOOP("QRegularExpression", "nested recursion at the same subject position"), - QT_TRANSLATE_NOOP("QRegularExpression", "recursion limit exceeded"), + QT_TRANSLATE_NOOP("QRegularExpression", "matching depth limit exceeded"), QT_TRANSLATE_NOOP("QRegularExpression", "requested value is not available"), QT_TRANSLATE_NOOP("QRegularExpression", "requested value is not set"), QT_TRANSLATE_NOOP("QRegularExpression", "offset limit set without PCRE2_USE_OFFSET_LIMIT"), QT_TRANSLATE_NOOP("QRegularExpression", "bad escape sequence in replacement string"), QT_TRANSLATE_NOOP("QRegularExpression", "expected closing curly bracket in replacement string"), QT_TRANSLATE_NOOP("QRegularExpression", "bad substitution in replacement string"), - QT_TRANSLATE_NOOP("QRegularExpression", "match with end before start is not supported"), - QT_TRANSLATE_NOOP("QRegularExpression", "too many replacements (more than INT_MAX)") + QT_TRANSLATE_NOOP("QRegularExpression", "match with end before start or start moved backwards is not supported"), + QT_TRANSLATE_NOOP("QRegularExpression", "too many replacements (more than INT_MAX)"), + QT_TRANSLATE_NOOP("QRegularExpression", "bad serialized data"), + QT_TRANSLATE_NOOP("QRegularExpression", "heap limit exceeded"), + QT_TRANSLATE_NOOP("QRegularExpression", "invalid syntax"), + QT_TRANSLATE_NOOP("QRegularExpression", "internal error - duplicate substitution match"), + QT_TRANSLATE_NOOP("QRegularExpression", "PCRE2_MATCH_INVALID_UTF is not supported for DFA matching") }; #endif // #if 0 -- cgit v1.2.3 From 411c2e3e4f32ab98bab65bcd53faf11da3c4efd0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 27 Dec 2019 12:49:44 +0100 Subject: QCommonStyle: make sure to pass the widget to pixelMetric() QStyle::pixelMetric() expects the affected QWidget as third parameter. Some (external) styles rely on this to return the correct value. Therefore add the widget to the function calls where possible. Fixes: QTBUG-80971 Task-number: QTBUG-1857 Change-Id: I768ebb61a914cdba6e0549f841d46cf3edb0a2a6 Reviewed-by: Friedemann Kleint --- src/widgets/styles/qcommonstyle.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 09d65f0346..bc423187d2 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4569,7 +4569,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid case PM_MenuPanelWidth: case PM_TabBarBaseOverlap: case PM_TabBarBaseHeight: - ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt); + ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); break; case PM_MdiSubWindowFrameWidth: @@ -4801,7 +4801,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_TabBarIconSize: - ret = proxy()->pixelMetric(PM_SmallIconSize, opt); + ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; case PM_ListViewIconSize: #if QT_CONFIG(filedialog) @@ -4809,7 +4809,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = int(QStyleHelper::dpiScaled(24., opt)); else #endif - ret = proxy()->pixelMetric(PM_SmallIconSize, opt); + ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; case PM_ButtonIconSize: @@ -4817,7 +4817,7 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = int(QStyleHelper::dpiScaled(16, opt)); break; case PM_IconViewIconSize: - ret = proxy()->pixelMetric(PM_LargeIconSize, opt); + ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); break; case PM_LargeIconSize: @@ -4855,13 +4855,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid ret = int(QStyleHelper::dpiScaled(16, opt)); break; case PM_ScrollView_ScrollBarSpacing: - ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt); + ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); break; case PM_ScrollView_ScrollBarOverlap: ret = 0; break; case PM_SubMenuOverlap: - ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt); + ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); break; case PM_TreeViewIndentation: ret = int(QStyleHelper::dpiScaled(20, opt)); -- cgit v1.2.3 From 27d139128013c969a939779536485c1a80be977e Mon Sep 17 00:00:00 2001 From: Tuomas Heimonen Date: Fri, 29 Nov 2019 09:27:35 +0200 Subject: QLocale: Support Indian number formatting When QLocale::Country is set to QLocale::India numbers are written so that after first three from the right and then after every second will be comma. E.g. 10000000 is written as 1,00,00,000 Task-number: QTBUG-24301 Change-Id: Ic06241c127b0af1824104f94f7e2ce6e2058a070 Reviewed-by: Venugopal Shivashankar Reviewed-by: Teemu Holappa --- src/corelib/text/qlocale.cpp | 45 +++++++++++++++++++++++++++++++++----------- src/corelib/text/qlocale_p.h | 3 ++- 2 files changed, 36 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 75a5bc802e..425cb87d31 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1969,7 +1969,8 @@ QString QLocale::toString(qlonglong i) const { int flags = d->m_numberOptions & OmitGroupSeparator ? 0 - : QLocaleData::ThousandsGroup; + : (d->m_data->m_country_id == Country::India) + ? QLocaleData::IndianNumberGrouping : QLocaleData::ThousandsGroup; return d->m_data->longLongToString(i, -1, 10, -1, flags); } @@ -1984,7 +1985,8 @@ QString QLocale::toString(qulonglong i) const { int flags = d->m_numberOptions & OmitGroupSeparator ? 0 - : QLocaleData::ThousandsGroup; + : (d->m_data->m_country_id == Country::India) + ? QLocaleData::IndianNumberGrouping : QLocaleData::ThousandsGroup; return d->m_data->unsLongLongToString(i, -1, 10, -1, flags); } @@ -3626,10 +3628,19 @@ QT_WARNING_DISABLE_MSVC(4146) QT_WARNING_POP uint cnt_thousand_sep = 0; - if (flags & ThousandsGroup && base == 10) { - for (int i = num_str.length() - 3; i > 0; i -= 3) { - num_str.insert(i, group); - ++cnt_thousand_sep; + if (base == 10){ + if (flags & ThousandsGroup) { + for (int i = num_str.length() - 3; i > 0; i -= 3) { + num_str.insert(i, group); + ++cnt_thousand_sep; + } + } else if (flags & IndianNumberGrouping) { + if (num_str.length() > 3) + num_str.insert(num_str.length() - 3 , group); + for (int i = num_str.length() - 6; i > 0; i -= 2) { + num_str.insert(i, group); + ++cnt_thousand_sep; + } } } @@ -3713,10 +3724,19 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group, } uint cnt_thousand_sep = 0; - if (flags & ThousandsGroup && base == 10) { - for (int i = num_str.length() - 3; i > 0; i -=3) { - num_str.insert(i, group); - ++cnt_thousand_sep; + if (base == 10) { + if (flags & ThousandsGroup) { + for (int i = num_str.length() - 3; i > 0; i -=3) { + num_str.insert(i, group); + ++cnt_thousand_sep; + } + } else if (flags & IndianNumberGrouping) { + if (num_str.length() > 3) + num_str.insert(num_str.length() - 3 , group); + for (int i = num_str.length() - 6; i > 0; i -= 2) { + num_str.insert(i, group); + ++cnt_thousand_sep; + } } } @@ -3851,7 +3871,10 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o // check distance from the last separator or from the beginning of the digits // ### FIXME: Some locales allow other groupings! // See https://en.wikipedia.org/wiki/Thousands_separator - if (last_separator_idx != -1 && idx - last_separator_idx != 4) + if (m_country_id == QLocale::India) { + if (last_separator_idx != -1 && idx - last_separator_idx != 3) + return false; + } else if (last_separator_idx != -1 && idx - last_separator_idx != 4) return false; if (last_separator_idx == -1 && (start_of_digits_idx == -1 || idx - start_of_digits_idx > 3)) { diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index edee3a89c7..bb24009523 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -213,7 +213,8 @@ public: ShowBase = 0x80, UppercaseBase = 0x100, ZeroPadExponent = 0x200, - ForcePoint = 0x400 + ForcePoint = 0x400, + IndianNumberGrouping= 0x800 }; enum NumberMode { IntegerMode, DoubleStandardMode, DoubleScientificMode }; -- cgit v1.2.3 From a63969081c2f1656636f6fbc24b402a0f72c410b Mon Sep 17 00:00:00 2001 From: Alexandra Cherdantseva Date: Thu, 26 Dec 2019 16:17:20 +0300 Subject: wasm: support all cursor shapes Every Qt::CursorShape is supported. Tested in Chrome, Firefox and Safari. Change-Id: I38c9024dba4af70af789ac84ad7e38f749c847d7 Reviewed-by: Lorn Potter --- src/plugins/platforms/wasm/qwasmcursor.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/wasm/qwasmcursor.cpp b/src/plugins/platforms/wasm/qwasmcursor.cpp index 2b3f37300d..28ec3b58dd 100644 --- a/src/plugins/platforms/wasm/qwasmcursor.cpp +++ b/src/plugins/platforms/wasm/qwasmcursor.cpp @@ -68,6 +68,7 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape) cursorName = "default"; break; case Qt::UpArrowCursor: + cursorName = "n-resize"; break; case Qt::CrossCursor: cursorName = "crosshair"; @@ -91,7 +92,8 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape) cursorName = "nwse-resize"; break; case Qt::SizeAllCursor: - break; // no equivalent? + cursorName = "move"; + break; case Qt::BlankCursor: cursorName = "none"; break; @@ -111,18 +113,23 @@ QByteArray QWasmCursor::cursorShapeToHtml(Qt::CursorShape shape) cursorName = "help"; break; case Qt::BusyCursor: - cursorName = "wait"; + cursorName = "progress"; break; case Qt::OpenHandCursor: - break; // no equivalent? + cursorName = "grab"; + break; case Qt::ClosedHandCursor: - break; // no equivalent? + cursorName = "grabbing"; + break; case Qt::DragCopyCursor: - break; // no equivalent? + cursorName = "copy"; + break; case Qt::DragMoveCursor: - break; // no equivalent? + cursorName = "default"; + break; case Qt::DragLinkCursor: - break; // no equivalent? + cursorName = "alias"; + break; default: break; } -- cgit v1.2.3 From 663d00c71697a3383d9b3f3bb42b72c3d8eeaa05 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 19 Dec 2019 12:55:37 +0100 Subject: cborstreamwriter: Fix developer-build with clang Both functions are unused which results in a build error. Change-Id: If7e7a47cd62b91fbfc5bbf5330825bbb341a734b Reviewed-by: Thiago Macieira --- src/corelib/serialization/qcborstreamreader.cpp | 2 +- src/corelib/serialization/qcborstreamwriter.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/serialization/qcborstreamreader.cpp b/src/corelib/serialization/qcborstreamreader.cpp index 112fc6e226..c983436606 100644 --- a/src/corelib/serialization/qcborstreamreader.cpp +++ b/src/corelib/serialization/qcborstreamreader.cpp @@ -72,7 +72,7 @@ static CborError _cbor_value_dup_string(const CborValue *, void **, size_t *, Cb Q_UNREACHABLE(); return CborErrorInternalError; } -static CborError cbor_value_get_half_float_as_float(const CborValue *, float *) +static CborError Q_DECL_UNUSED cbor_value_get_half_float_as_float(const CborValue *, float *) { Q_UNREACHABLE(); return CborErrorInternalError; diff --git a/src/corelib/serialization/qcborstreamwriter.cpp b/src/corelib/serialization/qcborstreamwriter.cpp index d7f750b05e..9d78785416 100644 --- a/src/corelib/serialization/qcborstreamwriter.cpp +++ b/src/corelib/serialization/qcborstreamwriter.cpp @@ -63,13 +63,13 @@ QT_WARNING_POP // silence compilers that complain about this being a static function declared // but never defined -static CborError cbor_encoder_close_container_checked(CborEncoder*, const CborEncoder*) +static CborError Q_DECL_UNUSED cbor_encoder_close_container_checked(CborEncoder*, const CborEncoder*) { Q_UNREACHABLE(); return CborErrorInternalError; } -static CborError cbor_encode_float_as_half_float(CborEncoder *, float) +static CborError Q_DECL_UNUSED cbor_encode_float_as_half_float(CborEncoder *, float) { Q_UNREACHABLE(); return CborErrorInternalError; -- cgit v1.2.3 From 4b1d370f755578f60bd9c73ca98eeb8e71463caf Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 27 Dec 2019 11:48:26 +0100 Subject: Check platformNativeInterface pointer before dereferencing QApplication::platformNativeInterface() returns null if started with -platform offscreen. Fixes: QTBUG-80946 Change-Id: I3ad03ad27148c8576bd3fab0b136827bb8d171ae Reviewed-by: Christian Ehrlicher --- src/widgets/widgets/qmainwindow.cpp | 2 ++ src/widgets/widgets/qtoolbarlayout.cpp | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 16ed699137..e3dbe763e5 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1364,6 +1364,8 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) createWinId(); QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + if (!nativeInterface) + return; // Not Cocoa platform plugin. QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration("setContentBorderEnabled"); if (!function) diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index 961a261e8f..92094a38fb 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -360,6 +360,8 @@ void QToolBarLayout::updateMacBorderMetrics() return; QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface(); + if (!nativeInterface) + return; // Not Cocoa platform plugin. QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration("registerContentBorderArea"); if (!function) -- cgit v1.2.3 From 809a96d6d94a93046dc63dd6f52c51ae90c374f8 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Wed, 18 Dec 2019 19:06:18 +1000 Subject: wasm: fix setting translucent background MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to set the requested SurfaceFormat which may contain the alphaBufferSize in order for the GL context to have the alpha attribute Fixes: QTBUG-77303 Change-Id: I39860e24de49a255ab7e73bca78af92e6c074d0d Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/wasm/qwasmcompositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index a810880c43..e9c4559971 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -694,7 +694,7 @@ void QWasmCompositor::frame() if (m_context.isNull()) { m_context.reset(new QOpenGLContext()); - //mContext->setFormat(mScreen->format()); + m_context->setFormat(someWindow->window()->requestedFormat()); m_context->setScreen(screen()->screen()); m_context->create(); } -- cgit v1.2.3 From 2ced01cbdd10a9959db03406f74529cdcce544ca Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 4 Dec 2015 12:44:45 +0100 Subject: QIdentityProxyModel: implement moveRows / moveColumns It makes sense for it (instead of triggering the QAbstractItemModel base class implementation, which doesn't do anything). Safe to override virtuals in this case -- code calling the old version could not do anything useful, so at least new code gets those functions properly implemented for free. Change-Id: Iefe1ff25e15d877435e93ab28289ad2579616f72 Task-number: QTBUG-48076 Reviewed-by: Luca Beldi Reviewed-by: David Faure --- src/corelib/itemmodels/qidentityproxymodel.cpp | 24 ++++++++++++++++++++++++ src/corelib/itemmodels/qidentityproxymodel.h | 2 ++ 2 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp index 39992eccd3..f5684c6eda 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.cpp +++ b/src/corelib/itemmodels/qidentityproxymodel.cpp @@ -311,6 +311,30 @@ bool QIdentityProxyModel::removeRows(int row, int count, const QModelIndex& pare return d->model->removeRows(row, count, mapToSource(parent)); } +/*! + \reimp + \since 5.15 + */ +bool QIdentityProxyModel::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == this : true); + Q_ASSERT(destinationParent.isValid() ? destinationParent.model() == this : true); + Q_D(QIdentityProxyModel); + return d->model->moveRows(mapToSource(sourceParent), sourceRow, count, mapToSource(destinationParent), destinationChild); +} + +/*! + \reimp + \since 5.15 + */ +bool QIdentityProxyModel::moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) +{ + Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == this : true); + Q_ASSERT(destinationParent.isValid() ? destinationParent.model() == this : true); + Q_D(QIdentityProxyModel); + return d->model->moveColumns(mapToSource(sourceParent), sourceColumn, count, mapToSource(destinationParent), destinationChild); +} + /*! \reimp */ diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h index 89ac89cdba..4c14e6176a 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.h +++ b/src/corelib/itemmodels/qidentityproxymodel.h @@ -77,6 +77,8 @@ public: bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override; bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; + bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override; + bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild) override; protected: QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent); -- cgit v1.2.3 From 947704cefe9e8723c8c9bb332268dcedb1ea1060 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 2 Jan 2020 08:34:38 +0100 Subject: Freetype: Don't embolden bold fonts If a font does not set the "bold" flag in its OS/2 table, we check the weight from the same table to determine whether it is bold or if we have to embolden it synthetically. But the actual definition of bold in OS/2 is 700 (which is also what QFont::Bold is documented to correspond to in qfont.h). The result was that we would embolden fonts with bold weight if the bold flag was not set. An example of such a font was the CJK JP family of Noto Sans. [ChangeLog][Text] Fixed a problem where certain bold fonts would be synthetically emboldened by Qt when using the Freetype font engine. Fixes: QTBUG-80866 Change-Id: I2133d9c44a9e19c0f5f216a649ec64388245d34f Reviewed-by: Simon Hausmann --- src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp index 3e5939a5e4..64ceb69c23 100644 --- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp @@ -749,7 +749,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, // fake bold if ((fontDef.weight >= QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face)) { if (const TT_OS2 *os2 = reinterpret_cast(FT_Get_Sfnt_Table(face, ft_sfnt_os2))) { - if (os2->usWeightClass < 750) + if (os2->usWeightClass < 700) embolden = true; } } -- cgit v1.2.3 From b3f94eba6d4a329b5c64c7fb60ba33e3a8df301e Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 30 Dec 2019 19:42:33 +0100 Subject: SQL: add proper support to build QMYSQL with MariaDB client libraries The QMYSQL plugin can also be build with the MariaDB client libraries since they are source compatible. But the MariaDB libraries could not be found on windows because the library name differs. Therefore add the correct library names and update the documentation to make clear that MariaDB is supported through the QMYSQL plugin. [ChangeLog][Sql][QMYSQL] The QMYSQL plugin can now be build with the MariaDB C connector libs on Windows. Change-Id: Id99f8be96c4179fd2321b3e61c90bb300c53bb82 Reviewed-by: Marius Kittler Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/configure.json | 2 ++ src/plugins/sqldrivers/mysql/main.cpp | 4 ++- src/sql/doc/snippets/code/doc_src_sql-driver.qdoc | 2 +- src/sql/doc/src/sql-driver.qdoc | 32 ++++++++++++++++------- 4 files changed, 29 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/sqldrivers/configure.json b/src/plugins/sqldrivers/configure.json index cd20eef1df..28ccbeadcd 100644 --- a/src/plugins/sqldrivers/configure.json +++ b/src/plugins/sqldrivers/configure.json @@ -72,7 +72,9 @@ { "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": false }, { "type": "mysqlConfig", "query": "--libs", "cleanlibs": false }, { "libs": "-lmysqlclient_r", "condition": "!config.win32" }, + { "libs": "-llibmariadb", "condition": "config.win32" }, { "libs": "-llibmysql", "condition": "config.win32" }, + { "libs": "-lmariadb", "condition": "!config.win32" }, { "libs": "-lmysqlclient", "condition": "!config.win32" } ] }, diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp index d8d70483ef..4c6753097f 100644 --- a/src/plugins/sqldrivers/mysql/main.cpp +++ b/src/plugins/sqldrivers/mysql/main.cpp @@ -61,7 +61,9 @@ QMYSQLDriverPlugin::QMYSQLDriverPlugin() QSqlDriver* QMYSQLDriverPlugin::create(const QString &name) { - if (name == QLatin1String("QMYSQL") || name == QLatin1String("QMYSQL3")) { + if (name == QLatin1String("QMYSQL") || + name == QLatin1String("QMYSQL3") || + name == QLatin1String("QMARIADB")) { QMYSQLDriver* driver = new QMYSQLDriver(); return driver; } diff --git a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc index 12a39d80b2..b869b309b7 100644 --- a/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc +++ b/src/sql/doc/snippets/code/doc_src_sql-driver.qdoc @@ -235,7 +235,7 @@ make sub-oci //! [35] QSqlDatabase: QPSQL driver not loaded -QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7 +QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QMARIADB QODBC QODBC3 QPSQL QPSQL7 Could not create database object //! [35] diff --git a/src/sql/doc/src/sql-driver.qdoc b/src/sql/doc/src/sql-driver.qdoc index 3a0fcfa1e7..4d6df63749 100644 --- a/src/sql/doc/src/sql-driver.qdoc +++ b/src/sql/doc/src/sql-driver.qdoc @@ -48,7 +48,7 @@ \header \li Driver name \li DBMS \row \li \l{#QDB2}{QDB2} \li IBM DB2 (version 7.1 and above) \row \li \l{#QIBASE}{QIBASE} \li Borland InterBase - \row \li \l{#QMYSQL}{QMYSQL} \li MySQL (version 5.0 and above) + \row \li \l{#QMYSQL}{QMYSQL / MARIADB} \li MySQL or MariaDB (version 5.0 and above) \row \li \l{#QOCI}{QOCI} \li Oracle Call Interface Driver \row \li \l{#QODBC}{QODBC} \li Open Database Connectivity (ODBC) - Microsoft SQL Server and other @@ -123,7 +123,13 @@ \section1 Driver Specifics \target QMYSQL - \section2 QMYSQL for MySQL 5 and higher + \section2 QMYSQL for MySQL or MariaDB 5 and higher + + MariaDB is a fork of MySQL intended to remain free and open-source software + under the GNU General Public License. MariaDB intended to maintain high + compatibility with MySQL, ensuring a drop-in replacement capability with + library binary parity and exact matching with MySQL APIs and commands. + Therefore the plugin for MySQL and MariaDB are combined into one Qt plugin. \section3 QMYSQL Stored Procedure Support @@ -158,12 +164,13 @@ \section3 How to Build the QMYSQL Plugin on Unix and \macos - You need the MySQL header files, as well as the shared library - \c{libmysqlclient.so}. Depending on your Linux distribution, you may - need to install a package which is usually called "mysql-devel". + You need the MySQL / MariaDB header files, as well as the shared library + \c{libmysqlclient.so} / \c{libmariadb.so}. Depending on your Linux distribution, + you may need to install a package which is usually called "mysql-devel" + or "mariadb-devel". - Tell \l qmake where to find the MySQL header files and shared - libraries (here it is assumed that MySQL is installed in + Tell \l qmake where to find the MySQL / MariaDB header files and shared + libraries (here it is assumed that MySQL / MariaDB is installed in \c{/usr/local}) and run \c{make}: \snippet code/doc_src_sql-driver.qdoc 3 @@ -171,7 +178,8 @@ \section3 How to Build the QMYSQL Plugin on Windows You need to get the MySQL installation files (e.g. - \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.18.0.msi}). + \l {https://dev.mysql.com/downloads/installer/}{mysql-installer-web-community-8.0.18.0.msi}) or + \l {https://downloads.mariadb.org/connector-c/3.1.5/}{mariadb-connector-c-3.1.5-win64.msi}. Run the installer, select custom installation and install the MySQL C Connector which matches your Qt installation (x86 or x64). @@ -181,6 +189,12 @@ \li \c {/lib/libmysql.dll} \li \c {/include/mysql.h} \endlist + and for MariaDB + \list + \li \c {/lib/libmariadb.lib} + \li \c {/lib/libmariadb.dll} + \li \c {/include/mysql.h} + \endlist Build the plugin as follows (here it is assumed that the MySQL C Connector is installed in @@ -191,7 +205,7 @@ If you are not using a Microsoft compiler, replace \c nmake with \c mingw32-make in the line above. - When you distribute your application, remember to include libmysql.dll + When you distribute your application, remember to include libmysql.dll / libmariadb.dll in your installation package. It must be placed in the same folder as the application executable. \e libmysql.dll additionally needs the MSVC runtime libraries which can be installed with vcredist.exe -- cgit v1.2.3 From 3a9251e8691f77c849c93f8d40784fae77f0a923 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jan 2020 13:08:21 +0100 Subject: Fix parameter of QJsonObject::const_iterator operator-(const_iterator) It used to be "iterator", causing a qdoc warning: src/corelib/serialization/qjsonobject.cpp:1405: (qdoc) warning: clang found diagnostics parsing \fn int QJsonObject::const_iterator::operator-(const_iterator other) const error: out-of-line definition of 'operator-' does not match any declaration in 'QJsonObject::const_iterator' Add a small test. Change-Id: Id65effffa720ed1e0fb0ee6937dcc4298f3ef363 Reviewed-by: Lars Knoll --- src/corelib/serialization/qjsonobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/serialization/qjsonobject.h b/src/corelib/serialization/qjsonobject.h index cfb44c9c55..c31be0353d 100644 --- a/src/corelib/serialization/qjsonobject.h +++ b/src/corelib/serialization/qjsonobject.h @@ -221,7 +221,7 @@ public: inline const_iterator operator-(int j) const { return operator+(-j); } inline const_iterator &operator+=(int j) { i += j; return *this; } inline const_iterator &operator-=(int j) { i -= j; return *this; } - int operator-(iterator j) const { return i - j.i; } + int operator-(const_iterator j) const { return i - j.i; } inline bool operator==(const iterator &other) const { return i == other.i; } inline bool operator!=(const iterator &other) const { return i != other.i; } -- cgit v1.2.3 From 71477104eb0be31452664e22927beb909465ffcd Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 2 Jan 2020 12:31:27 +0100 Subject: Fix some qdoc warnings src/corelib/serialization/qjsonvalue.cpp:174: (qdoc) warning: No such parameter 'n' in QJsonValue::QJsonValue() ... examples/widgets/doc/src/icons.qdoc:584: (qdoc) warning: Command '\snippet (//! [24])' failed at end of file 'widgets/icons/mainwindow.cpp' src/corelib/text/qbytearray.cpp:5177: (qdoc) warning: clang found diagnostics parsing \fn QByteArray::FromBase64Result::operator QByteArray() const error: out-of-line definition of 'operator QByteArray' does not match any declaration in 'QByteArray::FromBase64Result' src/corelib/serialization/qjsonarray.cpp:178: (qdoc) warning: Overrides a previous doc src/corelib/serialization/qjsonarray.cpp:140: (qdoc) warning: (The previous doc is here) src/corelib/serialization/qjsonobject.cpp:1016: (qdoc) warning: clang found diagnostics parsing \fn QJsonValueRef QJsonObject::iterator::operator[](int j) const error: out-of-line definition of 'operator[]' does not match any declaration in 'QJsonObject::iterator' src/corelib/serialization/qjsonobject.cpp:1267: (qdoc) warning: clang found diagnostics parsing \fn QJsonValue QJsonObject::const_iterator::operator[](int j) const error: out-of-line definition of 'operator[]' does not match any declaration in 'QJsonObject::const_iterator' src/corelib/tools/qhash.cpp:2641: (qdoc) warning: Overrides a previous doc src/corelib/tools/qhash.cpp:1492: (qdoc) warning: (The previous doc is here) src/corelib/tools/qhash.cpp:2659: (qdoc) warning: Can't link to 'unit()' src/corelib/text/qchar.cpp:274: (qdoc) warning: Undocumented enum item 'Script_Sundanese' in QChar::Script src/corelib/text/qchar.cpp:274: (qdoc) warning: No such enum item 'Script_Sundaneseo' in QChar::Script src/network/ssl/qsslsocket.cpp:1514: (qdoc) warning: Can't link to 'QSslConfiguration::addDefaultCaCertificate()' src/widgets/widgets/qtabwidget.cpp:581: (qdoc) warning: Undocumented parameter 'visible' in QTabWidget::setTabVisible() Change-Id: I05c2a4884873850b684fa94036cd90db1a6e7726 Reviewed-by: Lars Knoll --- src/corelib/serialization/qjsonarray.cpp | 12 ++++++------ src/corelib/serialization/qjsonobject.cpp | 4 ++-- src/corelib/serialization/qjsonvalue.cpp | 6 +++--- src/corelib/text/qbytearray.cpp | 13 +++++++------ src/corelib/text/qchar.cpp | 2 +- src/corelib/tools/qhash.cpp | 4 ++-- src/network/ssl/qsslsocket.cpp | 2 +- src/widgets/widgets/qtabwidget.cpp | 2 +- 8 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp index c5d4bf0315..08702771a8 100644 --- a/src/corelib/serialization/qjsonarray.cpp +++ b/src/corelib/serialization/qjsonarray.cpp @@ -175,12 +175,6 @@ void QJsonArray::initialize() */ QJsonArray::~QJsonArray() = default; -/*! - Creates a copy of \a other. - - Since QJsonArray is implicitly shared, the copy is shallow - as long as the object doesn't get modified. - */ QJsonArray::QJsonArray(std::initializer_list args) { initialize(); @@ -188,6 +182,12 @@ QJsonArray::QJsonArray(std::initializer_list args) append(arg); } +/*! + Creates a copy of \a other. + + Since QJsonArray is implicitly shared, the copy is shallow + as long as the object doesn't get modified. + */ QJsonArray::QJsonArray(const QJsonArray &other) { a = other.a; diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp index ae37481f31..a6987279d3 100644 --- a/src/corelib/serialization/qjsonobject.cpp +++ b/src/corelib/serialization/qjsonobject.cpp @@ -1013,7 +1013,7 @@ QJsonObject::const_iterator QJsonObject::constFindImpl(T key) const Returns a pointer to a modifiable reference to the current item. */ -/*! \fn QJsonValueRef QJsonObject::iterator::operator[](int j) const +/*! \fn const QJsonValueRef QJsonObject::iterator::operator[](int j) Returns a modifiable reference to the item at offset \a j from the item pointed to by this iterator (the item at position \c{*this + j}). @@ -1264,7 +1264,7 @@ QJsonObject::const_iterator QJsonObject::constFindImpl(T key) const Returns a pointer to the current item. */ -/*! \fn QJsonValue QJsonObject::const_iterator::operator[](int j) const +/*! \fn const QJsonValue QJsonObject::const_iterator::operator[](int j) Returns the item at offset \a j from the item pointed to by this iterator (the item at position \c{*this + j}). diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp index 6cf4c7fdf9..7b6728d525 100644 --- a/src/corelib/serialization/qjsonvalue.cpp +++ b/src/corelib/serialization/qjsonvalue.cpp @@ -149,7 +149,7 @@ QJsonValue::QJsonValue(bool b) } /*! - Creates a value of type Double, with value \a n. + Creates a value of type Double, with value \a v. */ QJsonValue::QJsonValue(double v) : d(nullptr) @@ -164,7 +164,7 @@ QJsonValue::QJsonValue(double v) /*! \overload - Creates a value of type Double, with value \a n. + Creates a value of type Double, with value \a v. */ QJsonValue::QJsonValue(int v) : n(v), t(QCborValue::Integer) @@ -173,7 +173,7 @@ QJsonValue::QJsonValue(int v) /*! \overload - Creates a value of type Double, with value \a n. + Creates a value of type Double, with value \a v. NOTE: the integer limits for IEEE 754 double precision data is 2^53 (-9007199254740992 to +9007199254740992). If you pass in values outside this range expect a loss of precision to occur. */ diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 94d22e288e..27e0d56225 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -5175,7 +5175,7 @@ void warn(WarningType w, EmittingClass c) */ /*! - \fn QByteArray::FromBase64Result::operator QByteArray() const + \fn QByteArray &QByteArray::FromBase64Result::operator*() const Returns the decoded byte array. */ @@ -5184,17 +5184,18 @@ void warn(WarningType w, EmittingClass c) \fn bool operator==(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept \relates QByteArray::FromBase64Result - Compares \a lhs and \a rhs for equality. \a lhs and \a rhs are equal - if and only if they contain the same decoding status and, if the - status is QByteArray::Base64DecodingStatus::Ok, if and only if - they contain the same decoded data. + Returns \c true if \a lhs and \a rhs are equal, otherwise returns \c false. + + \a lhs and \a rhs are equal if and only if they contain the same decoding + status and, if the status is QByteArray::Base64DecodingStatus::Ok, if and + only if they contain the same decoded data. */ /*! \fn bool operator!=(const QByteArray::FromBase64Result &lhs, const QByteArray::FromBase64Result &rhs) noexcept \relates QByteArray::FromBase64Result - Compares \a lhs and \a rhs for inequality. + Returns \c true if \a lhs and \a rhs are different, otherwise returns \c false. */ /*! diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index 847b4f0b08..61b61125b1 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -418,7 +418,7 @@ QT_BEGIN_NAMESPACE \value Script_Sogdian Since Qt 5.15 \value Script_SoraSompeng \value Script_Soyombo Since Qt 5.11 - \value Script_Sundaneseo + \value Script_Sundanese \value Script_SylotiNagri \value Script_Syriac \value Script_Tagalog diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 3ff8f886f1..77c8da7f4a 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -2638,7 +2638,7 @@ uint qHash(long double key, uint seed) noexcept \sa insert() */ -/*! \fn template QList QHash::uniqueKeys() const +/*! \fn template QList QMultiHash::uniqueKeys() const \since 5.13 Returns a list containing all the keys in the map. Keys that occur multiple @@ -2661,7 +2661,7 @@ uint qHash(long double key, uint seed) noexcept Inserts all the items in the \a other hash into this hash and returns a reference to this hash. - \sa unit(), insert() + \sa unite(), insert() */ /*! \fn template QMultiHash QMultiHash::operator+(const QMultiHash &other) const diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 0828a795f1..1b72be66fe 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1526,7 +1526,7 @@ QList QSslSocket::caCertificates() const default CA certificate database. \sa QSslConfiguration::caCertificates(), QSslConfiguration::addCaCertificates(), - QSslConfiguration::addDefaultCaCertificate() + QSslConfiguration::addCaCertificate() */ bool QSslSocket::addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat encoding, QRegExp::PatternSyntax syntax) diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index 5b3dcfa45b..f0bfe67e3a 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -579,7 +579,7 @@ bool QTabWidget::isTabVisible(int index) const } /*! - If \a enable is true, the page at position \a index is visible; otherwise the page at + If \a visible is true, the page at position \a index is visible; otherwise the page at position \a index is hidden. The page's tab is redrawn appropriately. \sa isTabVisible() -- cgit v1.2.3