summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp27
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