QXmlStreamReader: change fastScanName() to take a Value*

For easier debugging, e.g. to print out value.len and value.prefix.

Change-Id: Ib0eed38772f899502962f578775d34ea2744fdde
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1a423ce4372d18a779f3c0d746d5283d9a425839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ahmad Samir 2023-04-12 13:10:26 +02:00 committed by Qt Cherry-pick Bot
parent c131e159b0
commit 47c6473680
4 changed files with 13 additions and 11 deletions

View File

@ -1296,7 +1296,7 @@ inline qsizetype QXmlStreamReaderPrivate::fastScanContentCharList()
return n;
}
inline qsizetype QXmlStreamReaderPrivate::fastScanName(qint16 *prefix)
inline qsizetype QXmlStreamReaderPrivate::fastScanName(Value *val)
{
qsizetype n = 0;
uint c;
@ -1333,16 +1333,16 @@ inline qsizetype QXmlStreamReaderPrivate::fastScanName(qint16 *prefix)
case '+':
case '*':
putChar(c);
if (prefix && *prefix == n+1) {
*prefix = 0;
if (val && val->prefix == n + 1) {
val->prefix = 0;
putChar(':');
--n;
}
return n;
case ':':
if (prefix) {
if (*prefix == 0) {
*prefix = qint16(n + 2);
if (val) {
if (val->prefix == 0) {
val->prefix = qint16(n + 2);
} else { // only one colon allowed according to the namespace spec.
putChar(c);
return n;
@ -1358,8 +1358,8 @@ inline qsizetype QXmlStreamReaderPrivate::fastScanName(qint16 *prefix)
}
}
if (prefix)
*prefix = 0;
if (val)
val->prefix = 0;
qsizetype pos = textBuffer.size() - n;
putString(textBuffer, pos);
textBuffer.resize(pos);

View File

@ -1419,7 +1419,8 @@ space_opt ::= space;
qname ::= LETTER;
/.
case $rule_number: {
sym(1).len += fastScanName(&sym(1).prefix);
Value &val = sym(1);
val.len += fastScanName(&val);
if (atEnd) {
resume($rule_number);
return false;

View File

@ -498,7 +498,7 @@ public:
qsizetype fastScanLiteralContent();
qsizetype fastScanSpace();
qsizetype fastScanContentCharList();
qsizetype fastScanName(qint16 *prefix = nullptr);
qsizetype fastScanName(Value *val = nullptr);
inline qsizetype fastScanNMTOKEN();

View File

@ -947,7 +947,8 @@ bool QXmlStreamReaderPrivate::parse()
break;
case 262: {
sym(1).len += fastScanName(&sym(1).prefix);
Value &val = sym(1);
val.len += fastScanName(&val);
if (atEnd) {
resume(262);
return false;