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 <giuseppe.dangelo@kdab.com>
This commit is contained in:
parent
8a0f100e97
commit
9e56d28663
@ -898,7 +898,7 @@ void QRegularExpressionPrivate::compilePattern()
|
|||||||
options |= PCRE2_UTF;
|
options |= PCRE2_UTF;
|
||||||
|
|
||||||
PCRE2_SIZE patternErrorOffset;
|
PCRE2_SIZE patternErrorOffset;
|
||||||
compiledPattern = pcre2_compile_16(pattern.utf16(),
|
compiledPattern = pcre2_compile_16(reinterpret_cast<PCRE2_SPTR16>(pattern.utf16()),
|
||||||
pattern.length(),
|
pattern.length(),
|
||||||
options,
|
options,
|
||||||
&errorCode,
|
&errorCode,
|
||||||
@ -1163,12 +1163,12 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString
|
|||||||
|
|
||||||
if (!previousMatchWasEmpty) {
|
if (!previousMatchWasEmpty) {
|
||||||
result = safe_pcre2_match_16(compiledPattern,
|
result = safe_pcre2_match_16(compiledPattern,
|
||||||
subjectUtf16, subjectLength,
|
reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
|
||||||
offset, pcreOptions,
|
offset, pcreOptions,
|
||||||
matchData, matchContext);
|
matchData, matchContext);
|
||||||
} else {
|
} else {
|
||||||
result = safe_pcre2_match_16(compiledPattern,
|
result = safe_pcre2_match_16(compiledPattern,
|
||||||
subjectUtf16, subjectLength,
|
reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
|
||||||
offset, pcreOptions | PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED,
|
offset, pcreOptions | PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED,
|
||||||
matchData, matchContext);
|
matchData, matchContext);
|
||||||
|
|
||||||
@ -1186,7 +1186,7 @@ QRegularExpressionMatchPrivate *QRegularExpressionPrivate::doMatch(const QString
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = safe_pcre2_match_16(compiledPattern,
|
result = safe_pcre2_match_16(compiledPattern,
|
||||||
subjectUtf16, subjectLength,
|
reinterpret_cast<PCRE2_SPTR16>(subjectUtf16), subjectLength,
|
||||||
offset, pcreOptions,
|
offset, pcreOptions,
|
||||||
matchData, matchContext);
|
matchData, matchContext);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user