diff options
author | Joni Poikelin <joni.poikelin@qt.io> | 2018-01-17 11:01:28 +0200 |
---|---|---|
committer | Joni Poikelin <joni.poikelin@qt.io> | 2018-01-25 14:47:46 +0000 |
commit | a87b549edfb66b3c3bc14466455792aea6e80c84 (patch) | |
tree | f3d92dc76cd22e1c00a100eb3d91081aa5e0bf6a /src/plugins | |
parent | 965bcca6d4e22788721a9af906adfbd97af9af29 (diff) |
Fix compilation with -no-feature-regularexpression
Change-Id: I4d213a266034d388af723337deeeb4cdd1f5cbdb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins')
-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 6b978a38fe..bdae764025 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -65,7 +65,6 @@ #include <QtCore/QMutex> #include <QtCore/QMutexLocker> #include <QtCore/QUuid> -#include <QtCore/QRegularExpression> #include <QtCore/QTemporaryFile> #include <QtCore/private/qsystemlibrary_p.h> @@ -1153,12 +1152,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 |