summaryrefslogtreecommitdiffstats
path: root/src/xml/sax
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-10-02 12:59:24 +0200
committerLiang Qi <liang.qi@qt.io>2018-11-07 13:19:54 +0000
commit825f98815683faea06144ab0262129b0367798ee (patch)
tree48b10de0d86c6312d07700eb4e690dbd87ab8db0 /src/xml/sax
parentb5d249f9538bf3dc44f11879c2244deb5a37bf97 (diff)
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 <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/xml/sax')
-rw-r--r--src/xml/sax/qxml.cpp14
1 files changed, 8 insertions, 6 deletions
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