From b40c8e306885aae2e44ee32a5b3a7e80d7737d5f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 27 Apr 2020 16:47:57 +0200 Subject: QXmlInputSource: change EndOf{Data,Document} ushort -> char16_t Allows continuing seamless conversion to QChar, unlike ushort, which is being made explicit or deprecated, or removed. Change-Id: I95480b013b5fbc95a2b45f860a01f24e6a97e5c8 Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/xml/sax/qxml.cpp | 18 +++++++++--------- src/xml/sax/qxml.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 0033d042d4..f5d283d5ac 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -1077,8 +1077,8 @@ void QXmlAttributes::append(const QString &qName, const QString &uri, const QStr */ // the following two are guaranteed not to be a character -const ushort QXmlInputSource::EndOfData = 0xfffe; -const ushort QXmlInputSource::EndOfDocument = 0xffff; +const char16_t QXmlInputSource::EndOfData = 0xfffe; +const char16_t QXmlInputSource::EndOfDocument = 0xffff; /* Common part of the constructors. @@ -1170,20 +1170,20 @@ QChar QXmlInputSource::next() d->nextReturnedEndOfData = false; fetchData(); if (d->pos >= d->length) { - return QChar(EndOfDocument); + return EndOfDocument; } return next(); } d->nextReturnedEndOfData = true; - return QChar(EndOfData); + return EndOfData; } // QXmlInputSource has no way to signal encoding errors. The best we can do // is return EndOfDocument. We do *not* return EndOfData, because the reader // will then just call this function again to get the next char. QChar c = d->unicode[d->pos++]; - if (c.unicode() == EndOfData) - c = QChar(EndOfDocument); + if (c == EndOfData) + c = EndOfDocument; return c; } @@ -7830,7 +7830,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 == QChar(QXmlInputSource::EndOfData) && parseStack == nullptr) + if (c == QXmlInputSource::EndOfData && parseStack == nullptr) c = inputSource->next(); if (uc == '\n') { lineNr++; @@ -7910,7 +7910,7 @@ QT_WARNING_POP */ void QXmlSimpleReaderPrivate::initData() { - c = QChar(QXmlInputSource::EndOfData); + c = QXmlInputSource::EndOfData; xmlRefStack.clear(); next(); } @@ -7961,7 +7961,7 @@ void QXmlSimpleReaderPrivate::unexpectedEof(ParseFunction where, int state) if (parseStack == nullptr) { reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF)); } else { - if (c == QChar(QXmlInputSource::EndOfDocument)) { + if (c == QXmlInputSource::EndOfDocument) { reportParseError(QLatin1String(XMLERR_UNEXPECTEDEOF)); } else { pushParseState(where, state); diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index e19a398ca7..5dd9afa672 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -208,8 +208,8 @@ public: virtual QChar next(); virtual void reset(); - static const ushort EndOfData; - static const ushort EndOfDocument; + static const char16_t EndOfData; + static const char16_t EndOfDocument; protected: virtual QString fromRawData(const QByteArray &data, bool beginning = false); -- cgit v1.2.3