From 9e56d28663b7df82882d2d0dcc72f3a48bcc6cf9 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 10 May 2020 20:51:34 +0200 Subject: [PATCH] QRegularExpression: cast to PCRE2_SPTR16 It seems that PCRE2_UCHAR16 is exactly ushort, even though it's documented to be uint16_t. There's no requirement for these to be the same type, nor for the PCRE typedef to continue to point to the same type, so add explicit casts. Change-Id: I89f65d29feaada84ea00688976a123364857bc58 Reviewed-by: Giuseppe D'Angelo --- src/corelib/text/qregularexpression.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 9d21da4277..f479425bed 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -898,7 +898,7 @@ void QRegularExpressionPrivate::compilePattern() options |= PCRE2_UTF; PCRE2_SIZE patternErrorOffset; - compiledPattern = pcre2_compile_16(pattern.utf16(), + compiledPattern = pcre2_compile_16(reinterpret_cast(pattern.utf16()), pattern.length(), options, &errorCode, @@ -1163,12 +1163,12 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString if (!previousMatchWasEmpty) { result = safe_pcre2_match_16(compiledPattern, - subjectUtf16, subjectLength, + reinterpret_cast(subjectUtf16), subjectLength, offset, pcreOptions, matchData, matchContext); } else { result = safe_pcre2_match_16(compiledPattern, - subjectUtf16, subjectLength, + reinterpret_cast(subjectUtf16), subjectLength, offset, pcreOptions | PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED, matchData, matchContext); @@ -1186,7 +1186,7 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString } result = safe_pcre2_match_16(compiledPattern, - subjectUtf16, subjectLength, + reinterpret_cast(subjectUtf16), subjectLength, offset, pcreOptions, matchData, matchContext); }