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