From 407a39d3ca91fe6595c2ad9e0697c261a7e02680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 19 Aug 2022 09:37:53 +0200 Subject: [PATCH] wasm: use matchView() instead of match() QRegularExpression::match() is deprecated. Change-Id: I66c7b3043a3805614fedcdb081c7e704e9925e5e Reviewed-by: David Skoland Reviewed-by: Lorn Potter --- src/gui/platform/wasm/qlocalfileapi.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/platform/wasm/qlocalfileapi.cpp b/src/gui/platform/wasm/qlocalfileapi.cpp index ec7ae40391..b56490eba4 100644 --- a/src/gui/platform/wasm/qlocalfileapi.cpp +++ b/src/gui/platform/wasm/qlocalfileapi.cpp @@ -46,7 +46,7 @@ std::optional Type::fromQt(QStringView type) // Group 1 is treated as the description, whereas group 2 or 3 are treated as the filter list. static QRegularExpression regex( QString(QStringLiteral("(?:(?:([^(]*)\\(([^()]+)\\)[^)]*)|([^()]+))"))); - const auto match = regex.match(type); + const auto match = regex.matchView(type); if (!match.hasMatch()) return std::nullopt; @@ -86,7 +86,7 @@ std::optional Type::Accept::fromQt(QStringView qtRepresentation) // The next group of non-empty characters. static QRegularExpression internalRegex(QString(QStringLiteral("([^\\s]+)\\s*"))); int offset = 0; - auto internalMatch = internalRegex.match(qtRepresentation, offset); + auto internalMatch = internalRegex.matchView(qtRepresentation, offset); MimeType mimeType; while (internalMatch.hasMatch()) { @@ -97,7 +97,7 @@ std::optional Type::Accept::fromQt(QStringView qtRepresentation) mimeType.addExtension(*webExtension); - internalMatch = internalRegex.match(qtRepresentation, internalMatch.capturedEnd()); + internalMatch = internalRegex.matchView(qtRepresentation, internalMatch.capturedEnd()); } accept.addMimeType(mimeType); @@ -144,7 +144,7 @@ Type::Accept::MimeType::Extension::fromQt(QStringView qtRepresentation) // The web filter does not support wildcards. static QRegularExpression qtAcceptAllRegex( QRegularExpression::anchoredPattern(QString(QStringLiteral("[*]+|[*]+\\.[*]+")))); - if (qtAcceptAllRegex.match(qtRepresentation).hasMatch()) + if (qtAcceptAllRegex.matchView(qtRepresentation).hasMatch()) return std::nullopt; // Checks for correctness. The web filter only allows filename extensions and does not filter @@ -153,7 +153,7 @@ Type::Accept::MimeType::Extension::fromQt(QStringView qtRepresentation) static QRegularExpression qtFilenameMatcherRegex( QRegularExpression::anchoredPattern(QString(QStringLiteral("(\\*?)(\\.[^*]+)")))); - auto extensionMatch = qtFilenameMatcherRegex.match(qtRepresentation); + auto extensionMatch = qtFilenameMatcherRegex.matchView(qtRepresentation); if (extensionMatch.hasMatch()) return Extension(extensionMatch.capturedView(2));