|
Lines 1292-1298
inline qsizetype QXmlStreamReaderPrivate::fastScanContentCharList()
Link Here
|
| 1292 |
return n; |
1292 |
return n; |
| 1293 |
} |
1293 |
} |
| 1294 |
|
1294 |
|
| 1295 |
inline qsizetype QXmlStreamReaderPrivate::fastScanName(Value *val) |
1295 |
// Fast scan an XML attribute name (e.g. "xml:lang"). |
|
|
1296 |
inline QXmlStreamReaderPrivate::FastScanNameResult |
| 1297 |
QXmlStreamReaderPrivate::fastScanName(Value *val) |
| 1296 |
{ |
1298 |
{ |
| 1297 |
qsizetype n = 0; |
1299 |
qsizetype n = 0; |
| 1298 |
uint c; |
1300 |
uint c; |
|
Lines 1300-1306
inline qsizetype QXmlStreamReaderPrivate::fastScanName(Value *val)
Link Here
|
| 1300 |
if (n >= 4096) { |
1302 |
if (n >= 4096) { |
| 1301 |
// This is too long to be a sensible name, and |
1303 |
// This is too long to be a sensible name, and |
| 1302 |
// can exhaust memory, or the range of decltype(*prefix) |
1304 |
// can exhaust memory, or the range of decltype(*prefix) |
| 1303 |
return 0; |
1305 |
raiseNamePrefixTooLongError(); |
|
|
1306 |
return {}; |
| 1304 |
} |
1307 |
} |
| 1305 |
switch (c) { |
1308 |
switch (c) { |
| 1306 |
case '\n': |
1309 |
case '\n': |
|
Lines 1334-1351
inline qsizetype QXmlStreamReaderPrivate::fastScanName(Value *val)
Link Here
|
| 1334 |
putChar(':'); |
1337 |
putChar(':'); |
| 1335 |
--n; |
1338 |
--n; |
| 1336 |
} |
1339 |
} |
| 1337 |
return n; |
1340 |
return FastScanNameResult(n); |
| 1338 |
case ':': |
1341 |
case ':': |
| 1339 |
if (val) { |
1342 |
if (val) { |
| 1340 |
if (val->prefix == 0) { |
1343 |
if (val->prefix == 0) { |
| 1341 |
val->prefix = qint16(n + 2); |
1344 |
val->prefix = qint16(n + 2); |
| 1342 |
} else { // only one colon allowed according to the namespace spec. |
1345 |
} else { // only one colon allowed according to the namespace spec. |
| 1343 |
putChar(c); |
1346 |
putChar(c); |
| 1344 |
return n; |
1347 |
return FastScanNameResult(n); |
| 1345 |
} |
1348 |
} |
| 1346 |
} else { |
1349 |
} else { |
| 1347 |
putChar(c); |
1350 |
putChar(c); |
| 1348 |
return n; |
1351 |
return FastScanNameResult(n); |
| 1349 |
} |
1352 |
} |
| 1350 |
Q_FALLTHROUGH(); |
1353 |
Q_FALLTHROUGH(); |
| 1351 |
default: |
1354 |
default: |
|
Lines 1359-1365
inline qsizetype QXmlStreamReaderPrivate::fastScanName(Value *val)
Link Here
|
| 1359 |
qsizetype pos = textBuffer.size() - n; |
1362 |
qsizetype pos = textBuffer.size() - n; |
| 1360 |
putString(textBuffer, pos); |
1363 |
putString(textBuffer, pos); |
| 1361 |
textBuffer.resize(pos); |
1364 |
textBuffer.resize(pos); |
| 1362 |
return 0; |
1365 |
return FastScanNameResult(0); |
| 1363 |
} |
1366 |
} |
| 1364 |
|
1367 |
|
| 1365 |
enum NameChar { NameBeginning, NameNotBeginning, NotName }; |
1368 |
enum NameChar { NameBeginning, NameNotBeginning, NotName }; |
|
Lines 1839-1844
void QXmlStreamReaderPrivate::raiseWellFormedError(const QString &message)
Link Here
|
| 1839 |
raiseError(QXmlStreamReader::NotWellFormedError, message); |
1842 |
raiseError(QXmlStreamReader::NotWellFormedError, message); |
| 1840 |
} |
1843 |
} |
| 1841 |
|
1844 |
|
|
|
1845 |
void QXmlStreamReaderPrivate::raiseNamePrefixTooLongError() |
| 1846 |
{ |
| 1847 |
// TODO: add a ImplementationLimitsExceededError and use it instead |
| 1848 |
raiseError(QXmlStreamReader::NotWellFormedError, |
| 1849 |
QXmlStream::tr("Length of XML attribute name exceeds implemnetation limits (4KiB " |
| 1850 |
"characters).")); |
| 1851 |
} |
| 1852 |
|
| 1842 |
void QXmlStreamReaderPrivate::parseError() |
1853 |
void QXmlStreamReaderPrivate::parseError() |
| 1843 |
{ |
1854 |
{ |
| 1844 |
|
1855 |
|