summaryrefslogtreecommitdiffstats
path: root/src/xml/sax
diff options
context:
space:
mode:
Diffstat (limited to 'src/xml/sax')
-rw-r--r--src/xml/sax/qxml.cpp128
-rw-r--r--src/xml/sax/qxml.h8
-rw-r--r--src/xml/sax/qxml_p.h2
3 files changed, 68 insertions, 70 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index b2fff5b61f..1993073cce 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -1079,12 +1079,12 @@ void QXmlInputSource::init()
d = new QXmlInputSourcePrivate;
QT_TRY {
- d->inputDevice = 0;
- d->inputStream = 0;
+ d->inputDevice = nullptr;
+ d->inputStream = nullptr;
setData(QString());
#if QT_CONFIG(textcodec)
- d->encMapper = 0;
+ d->encMapper = nullptr;
#endif
d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
@@ -1161,12 +1161,12 @@ QChar QXmlInputSource::next()
d->nextReturnedEndOfData = false;
fetchData();
if (d->pos >= d->length) {
- return EndOfDocument;
+ return QChar(EndOfDocument);
}
return next();
}
d->nextReturnedEndOfData = true;
- return EndOfData;
+ return QChar(EndOfData);
}
// QXmlInputSource has no way to signal encoding errors. The best we can do
@@ -1174,7 +1174,7 @@ QChar QXmlInputSource::next()
// will then just call this function again to get the next char.
QChar c = d->unicode[d->pos++];
if (c.unicode() == EndOfData)
- c = EndOfDocument;
+ c = QChar(EndOfDocument);
return c;
}
@@ -1313,8 +1313,8 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
return QString();
while (pos < endPos) {
- ushort uc = text.at(pos).unicode();
- if (uc == '\'' || uc == '"')
+ QChar uc = text.at(pos);
+ if (uc == u'\'' || uc == u'"')
break;
++pos;
}
@@ -1325,8 +1325,8 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
QString encoding;
++pos;
while (pos < endPos) {
- ushort uc = text.at(pos).unicode();
- if (uc == '\'' || uc == '"')
+ QChar uc = text.at(pos);
+ if (uc == u'\'' || uc == u'"')
break;
encoding.append(uc);
++pos;
@@ -1357,13 +1357,13 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
return QString();
if (beginning) {
delete d->encMapper;
- d->encMapper = 0;
+ d->encMapper = nullptr;
}
int mib = 106; // UTF-8
// This is the initial UTF codec we will read the encoding declaration with
- if (d->encMapper == 0) {
+ if (d->encMapper == nullptr) {
d->encodingDeclBytes.clear();
d->encodingDeclChars.clear();
d->lookingForEncodingDecl = true;
@@ -2377,7 +2377,7 @@ bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&,
bool QXmlDefaultHandler::resolveEntity(const QString&, const QString&,
QXmlInputSource*& ret)
{
- ret = 0;
+ ret = nullptr;
return true;
}
@@ -2520,15 +2520,15 @@ inline void QXmlSimpleReaderPrivate::refClear()
QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
{
q_ptr = reader;
- parseStack = 0;
+ parseStack = nullptr;
locator.reset(new QXmlSimpleReaderLocator(reader));
- entityRes = 0;
- dtdHnd = 0;
- contentHnd = 0;
- errorHnd = 0;
- lexicalHnd = 0;
- declHnd = 0;
+ entityRes = nullptr;
+ dtdHnd = nullptr;
+ contentHnd = nullptr;
+ errorHnd = nullptr;
+ lexicalHnd = nullptr;
+ declHnd = nullptr;
// default feature settings
useNamespaces = true;
@@ -2932,7 +2932,7 @@ bool QXmlSimpleReader::feature(const QString& name, bool *ok) const
{
const QXmlSimpleReaderPrivate *d = d_func();
- if (ok != 0)
+ if (ok)
*ok = true;
if (name == QLatin1String("http://xml.org/sax/features/namespaces")) {
return d->useNamespaces;
@@ -2946,7 +2946,7 @@ bool QXmlSimpleReader::feature(const QString& name, bool *ok) const
return d->reportEntities;
} else {
qWarning("Unknown feature %s", name.toLatin1().data());
- if (ok != 0)
+ if (ok)
*ok = false;
}
return false;
@@ -3023,9 +3023,9 @@ bool QXmlSimpleReader::hasFeature(const QString& name) const
*/
void* QXmlSimpleReader::property(const QString&, bool *ok) const
{
- if (ok != 0)
+ if (ok)
*ok = false;
- return 0;
+ return nullptr;
}
/*! \reimp
@@ -3206,7 +3206,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
d->initIncrementalParsing();
} else {
delete d->parseStack;
- d->parseStack = 0;
+ d->parseStack = nullptr;
}
d->init(input);
@@ -3251,7 +3251,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
bool QXmlSimpleReader::parseContinue()
{
Q_D(QXmlSimpleReader);
- if (d->parseStack == 0 || d->parseStack->isEmpty())
+ if (d->parseStack == nullptr || d->parseStack->isEmpty())
return false;
d->initData();
int state = d->parseStack->pop().state;
@@ -3268,7 +3268,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
if (state==0) {
if (!parseProlog()) {
if (incremental && error.isNull()) {
- pushParseState(0, 0);
+ pushParseState(nullptr, 0);
return true;
} else {
clear(tags);
@@ -3280,7 +3280,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
if (state==1) {
if (!parseElement()) {
if (incremental && error.isNull()) {
- pushParseState(0, 1);
+ pushParseState(nullptr, 1);
return true;
} else {
clear(tags);
@@ -3293,7 +3293,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
while (!atEnd()) {
if (!parseMisc()) {
if (incremental && error.isNull()) {
- pushParseState(0, 2);
+ pushParseState(nullptr, 2);
return true;
} else {
clear(tags);
@@ -3303,7 +3303,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
}
if (!atEndOrig && incremental) {
// we parsed something at all, so be prepared to come back later
- pushParseState(0, 2);
+ pushParseState(nullptr, 2);
return true;
}
// is stack empty?
@@ -3315,7 +3315,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
// call the handler
if (contentHnd) {
delete parseStack;
- parseStack = 0;
+ parseStack = nullptr;
if (!contentHnd->endDocument()) {
reportParseError(contentHnd->errorString());
return false;
@@ -3350,7 +3350,7 @@ bool QXmlSimpleReaderPrivate::parseBeginOrContinue(int state, bool incremental)
signed char state;
signed char input;
-(4) if (d->parseStack == 0 || d->parseStack->isEmpty()) {
+(4) if (d->parseStack == nullptr || d->parseStack->isEmpty()) {
(4a) ...
} else {
(4b) ...
@@ -3440,7 +3440,7 @@ bool QXmlSimpleReaderPrivate::parseProlog()
signed char state;
signed char input;
- if (parseStack == 0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr|| parseStack->isEmpty()) {
xmldecl_possible = true;
doctype_read = false;
state = Init;
@@ -3631,7 +3631,7 @@ bool QXmlSimpleReaderPrivate::parseElement()
int state;
int input;
- if (parseStack == 0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr|| parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -4000,7 +4000,7 @@ bool QXmlSimpleReaderPrivate::parseContent()
signed char state;
signed char input;
- if (parseStack == 0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
contentCharDataRead = false;
state = Init;
} else {
@@ -4303,7 +4303,7 @@ bool QXmlSimpleReaderPrivate::parseMisc()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -4458,7 +4458,7 @@ bool QXmlSimpleReaderPrivate::parsePI()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -4685,7 +4685,7 @@ bool QXmlSimpleReaderPrivate::parseDoctype()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
startDTDwasReported = false;
systemId.clear();
publicId.clear();
@@ -4896,7 +4896,7 @@ bool QXmlSimpleReaderPrivate::parseExternalID()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
systemId.clear();
publicId.clear();
state = Init;
@@ -5060,7 +5060,7 @@ bool QXmlSimpleReaderPrivate::parseMarkupdecl()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -5218,7 +5218,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -5255,7 +5255,7 @@ bool QXmlSimpleReaderPrivate::parsePEReference()
} else if (entityRes) {
QMap<QString,QXmlSimpleReaderPrivate::ExternParameterEntity>::Iterator it2;
it2 = externParameterEntities.find(ref());
- QXmlInputSource *ret = 0;
+ QXmlInputSource *ret = nullptr;
if (it2 != externParameterEntities.end()) {
if (!entityRes->resolveEntity((*it2).publicId, (*it2).systemId, ret)) {
delete ret;
@@ -5396,7 +5396,7 @@ bool QXmlSimpleReaderPrivate::parseAttlistDecl()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -5612,7 +5612,7 @@ bool QXmlSimpleReaderPrivate::parseAttType()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -5833,7 +5833,7 @@ bool QXmlSimpleReaderPrivate::parseAttValue()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -5975,7 +5975,7 @@ bool QXmlSimpleReaderPrivate::parseElementDecl()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -6184,7 +6184,7 @@ bool QXmlSimpleReaderPrivate::parseNotationDecl()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -6328,7 +6328,7 @@ bool QXmlSimpleReaderPrivate::parseChoiceSeq()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -6557,7 +6557,7 @@ bool QXmlSimpleReaderPrivate::parseEntityDecl()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -6832,7 +6832,7 @@ bool QXmlSimpleReaderPrivate::parseEntityValue()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -6951,7 +6951,7 @@ bool QXmlSimpleReaderPrivate::parseComment()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -7063,7 +7063,7 @@ bool QXmlSimpleReaderPrivate::parseAttribute()
int state;
int input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -7162,7 +7162,7 @@ bool QXmlSimpleReaderPrivate::parseName()
};
int state;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -7248,7 +7248,7 @@ bool QXmlSimpleReaderPrivate::parseNmtoken()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
state = Init;
} else {
state = parseStack->pop().state;
@@ -7356,7 +7356,7 @@ bool QXmlSimpleReaderPrivate::parseReference()
signed char state;
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
parseReference_charDataRead = false;
state = Init;
} else {
@@ -7582,7 +7582,7 @@ bool QXmlSimpleReaderPrivate::processReference()
if (parseReference_context == InContent) {
if (contentCharDataRead) {
if (reportWhitespaceCharData || !string().simplified().isEmpty()) {
- if (contentHnd != 0 && !contentHnd->characters(string())) {
+ if (contentHnd != nullptr && !contentHnd->characters(string())) {
reportParseError(contentHnd->errorString());
return false;
}
@@ -7610,7 +7610,7 @@ bool QXmlSimpleReaderPrivate::processReference()
// Included if validating
bool skipIt = true;
if (entityRes) {
- QXmlInputSource *ret = 0;
+ QXmlInputSource *ret = nullptr;
if (!entityRes->resolveEntity((*itExtern).publicId, (*itExtern).systemId, ret)) {
delete ret;
reportParseError(entityRes->errorString());
@@ -7696,7 +7696,7 @@ bool QXmlSimpleReaderPrivate::parseString()
signed char state; // state in this function is the position in the string s
signed char input;
- if (parseStack==0 || parseStack->isEmpty()) {
+ if (parseStack == nullptr || parseStack->isEmpty()) {
Done = parseString_s.length();
state = 0;
} else {
@@ -7800,7 +7800,7 @@ void QXmlSimpleReaderPrivate::next()
c = inputSource->next();
// If we are not incremental parsing, we just skip over EndOfData chars to give the
// parser an uninterrupted stream of document chars.
- if (c == QXmlInputSource::EndOfData && parseStack == 0)
+ if (c == QChar(QXmlInputSource::EndOfData) && parseStack == nullptr)
c = inputSource->next();
if (uc == '\n') {
lineNr++;
@@ -7832,7 +7832,7 @@ bool QXmlSimpleReaderPrivate::eat_ws()
}
next();
}
- if (parseStack != 0) {
+ if (parseStack != nullptr) {
unexpectedEof(&QXmlSimpleReaderPrivate::eat_ws, 0);
return false;
}
@@ -7877,7 +7877,7 @@ void QXmlSimpleReaderPrivate::init(const QXmlInputSource *i)
*/
void QXmlSimpleReaderPrivate::initData()
{
- c = QXmlInputSource::EndOfData;
+ c = QChar(QXmlInputSource::EndOfData);
xmlRefStack.clear();
next();
}
@@ -7922,10 +7922,10 @@ void QXmlSimpleReaderPrivate::reportParseError(const QString& error)
*/
void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state)
{
- if (parseStack == 0) {
+ if (parseStack == nullptr) {
reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
} else {
- if (c == QXmlInputSource::EndOfDocument) {
+ if (c == QChar(QXmlInputSource::EndOfDocument)) {
reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF));
} else {
pushParseState(where, state);
@@ -7942,7 +7942,7 @@ void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state)
*/
void QXmlSimpleReaderPrivate::parseFailed(ParseFunction where, int state)
{
- if (parseStack!=0 && error.isNull()) {
+ if (parseStack != nullptr && error.isNull()) {
pushParseState(where, state);
}
}
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 94dc8dfb8e..9be14bd7a9 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -116,16 +116,14 @@ class Q_XML_EXPORT QXmlAttributes
{
public:
QXmlAttributes();
-#ifdef Q_COMPILER_DEFAULT_MEMBERS
QXmlAttributes(const QXmlAttributes &) = default;
- QXmlAttributes(QXmlAttributes &&) Q_DECL_NOTHROW = default;
+ QXmlAttributes(QXmlAttributes &&) noexcept = default;
QXmlAttributes &operator=(const QXmlAttributes &) = default;
- QXmlAttributes &operator=(QXmlAttributes &&) Q_DECL_NOTHROW = default;
-#endif // default members
+ QXmlAttributes &operator=(QXmlAttributes &&) noexcept = default;
QT6_NOT_VIRTUAL ~QXmlAttributes();
- void swap(QXmlAttributes &other) Q_DECL_NOTHROW
+ void swap(QXmlAttributes &other) noexcept
{
qSwap(attList, other.attList);
qSwap(d, other.d);
diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h
index 98dc2aea0c..eb6135db04 100644
--- a/src/xml/sax/qxml_p.h
+++ b/src/xml/sax/qxml_p.h
@@ -229,7 +229,7 @@ private:
// for the DTD currently being parsed.
static const int dtdRecursionLimit = 2;
// The maximum amount of characters an entity value may contain, after expansion.
- static const int entityCharacterLimit = 1024;
+ static const int entityCharacterLimit = 4096;
const QString &string();
void stringClear();