From 825f98815683faea06144ab0262129b0367798ee Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 2 Oct 2018 12:59:24 +0200 Subject: Modernize the "textcodec" feature Also clean up QTextCodec usage in qmake build and some includes of qtextcodec.h. Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/xml/sax/qxml.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/xml/sax') diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 168e8c3cb4..7b6669b057 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -39,7 +39,9 @@ #include "qxml.h" #include "qxml_p.h" +#if QT_CONFIG(textcodec) #include "qtextcodec.h" +#endif #include "qbuffer.h" #include "qregexp.h" #include "qmap.h" @@ -237,7 +239,7 @@ public: int pos; int length; bool nextReturnedEndOfData; -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextDecoder *encMapper; #endif @@ -1075,7 +1077,7 @@ void QXmlInputSource::init() d->inputStream = 0; setData(QString()); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) d->encMapper = 0; #endif d->nextReturnedEndOfData = true; // first call to next() will call fetchData() @@ -1121,7 +1123,7 @@ QXmlInputSource::QXmlInputSource(QIODevice *dev) QXmlInputSource::~QXmlInputSource() { // ### close the input device. -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) delete d->encMapper; #endif delete d; @@ -1284,7 +1286,7 @@ void QXmlInputSource::fetchData() } } -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) static QString extractEncodingDecl(const QString &text, bool *needMoreText) { *needMoreText = false; @@ -1326,7 +1328,7 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText) return encoding; } -#endif // QT_NO_TEXTCODEC +#endif // textcodec /*! This function reads the XML file from \a data and tries to @@ -1341,7 +1343,7 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText) */ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning) { -#ifdef QT_NO_TEXTCODEC +#if !QT_CONFIG(textcodec) Q_UNUSED(beginning); return QString::fromLatin1(data.constData(), data.size()); #else -- cgit v1.2.3