diff options
author | Liang Qi <liang.qi@qt.io> | 2018-01-26 10:09:05 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-01-26 10:09:06 +0100 |
commit | 9f065554ffea0e3716b76e4bee4a60f0044193ce (patch) | |
tree | 735c2257cc9b50b847646aa1e0e5abb603b6482d /src/plugins/platforms/windows | |
parent | 6dbf3576093858d981d8321b00f0b19faa7cf217 (diff) | |
parent | 342bb5b03a76d1428fafb8e1532d66e172bd1c0b (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I7bfb75083f60190aa1def82d153f89925a92fd56
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsdialoghelpers.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index bc78f5054b..dfa93d18a6 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -68,7 +68,6 @@ #include <QtCore/QMutex> #include <QtCore/QMutexLocker> #include <QtCore/QUuid> -#include <QtCore/QRegularExpression> #include <QtCore/QTemporaryFile> #include <QtCore/private/qsystemlibrary_p.h> @@ -1135,12 +1134,32 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel } } +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')))) + return false; + } + return true; +} + static inline bool isClsid(const QString &s) { // detect "374DE290-123F-4565-9164-39C4925E467B". - static const QRegularExpression pattern(QLatin1String("\\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\z")); - Q_ASSERT(pattern.isValid()); - return pattern.match(s).hasMatch(); + const QChar dash(QLatin1Char('-')); + return s.size() == 36 + && isHexRange(s, 0, 8) + && s.at(8) == dash + && isHexRange(s, 9, 13) + && s.at(13) == dash + && isHexRange(s, 14, 18) + && s.at(18) == dash + && isHexRange(s, 19, 23) + && s.at(23) == dash + && isHexRange(s, 24, 36); } void QWindowsNativeFileDialogBase::selectFile(const QString &fileName) const |