Skip to content

Commit

Permalink
Get rid of some QTextCodec leftovers
Browse files Browse the repository at this point in the history
There's no real dependency to QTextCodec in those files anymore.

Change-Id: Ifaf19ab554fd108fa26095db4e2bd4a3e9ea427f
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
laknoll committed May 14, 2020
1 parent ada608d commit 2b8863a
Show file tree
Hide file tree
Showing 18 changed files with 6 additions and 45 deletions.
5 changes: 2 additions & 3 deletions examples/widgets/doc/src/application.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,8 @@
If we successfully opened the file, we use a QTextStream object
to read in the data. QTextStream automatically converts the 8-bit
data into a Unicode QString and supports various encodings. If no
encoding is specified, QTextStream assumes the file is written
using the system's default 8-bit encoding (for example, Latin-1;
see QTextCodec::codecForLocale() for details).
encoding is specified, QTextStream assumes the file is encoded in
UTF-8.

Since the call to QTextStream::readAll() might take some time, we
set the cursor to be Qt::WaitCursor for the entire application
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/io/qprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ QT_BEGIN_NAMESPACE
binary data (except for the NUL character). QProcessEnvironment will preserve
such variables, but does not support manipulating variables whose names or
values cannot be encoded by the current locale settings (see
QTextCodec::codecForLocale).
QString::toLocal8Bit).
On Windows, the variable names are case-insensitive, but case-preserving.
QProcessEnvironment behaves accordingly.
Expand Down
1 change: 0 additions & 1 deletion src/corelib/kernel/qcoreapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE


class QCoreApplicationPrivate;
class QTextCodec;
class QTranslator;
class QPostEventList;
class QStringList;
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/serialization/qtextstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
parameter: qSetFieldWidth(), qSetPadChar(), and
qSetRealNumberPrecision().
\sa QDataStream, QIODevice, QFile, QBuffer, QTcpSocket, {Text Codecs Example}
\sa QDataStream, QIODevice, QFile, QBuffer, QTcpSocket
*/

/*! \enum QTextStream::RealNumberNotation
Expand Down
4 changes: 0 additions & 4 deletions src/corelib/serialization/qtextstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@

QT_BEGIN_NAMESPACE


class QTextCodec;
class QTextDecoder;

class QTextStreamPrivate;
class Q_CORE_EXPORT QTextStream // text stream class
{
Expand Down
3 changes: 0 additions & 3 deletions src/corelib/serialization/qxmlstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@
#include <qdebug.h>
#include <qfile.h>
#include <stdio.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h>
#endif
#include <qstringconverter.h>
#include <qstack.h>
#include <qbuffer.h>
Expand Down
2 changes: 0 additions & 2 deletions src/corelib/text/qstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class QRegularExpression;
class QRegularExpressionMatch;
class QString;
class QStringList;
class QTextCodec;
class QStringRef;
template <typename T> class QVector;

Expand Down Expand Up @@ -1021,7 +1020,6 @@ class Q_CORE_EXPORT QString
static qlonglong toIntegral_helper(const QChar *data, int len, bool *ok, int base);
static qulonglong toIntegral_helper(const QChar *data, uint len, bool *ok, int base);
void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
friend class QTextCodec;
friend class QStringRef;
friend class QStringView;
friend class QByteArray;
Expand Down
1 change: 0 additions & 1 deletion src/platformsupport/input/libinput/qlibinputkeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
****************************************************************************/

#include "qlibinputkeyboard_p.h"
#include <QtCore/QTextCodec>
#include <QtCore/QLoggingCategory>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qinputdevicemanager_p.h>
Expand Down
1 change: 0 additions & 1 deletion src/plugins/platforms/windows/qwindowsmime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

#include <QtGui/private/qinternalmimedata_p.h>
#include <QtCore/qbytearraymatcher.h>
#include <QtCore/qtextcodec.h>
#include <QtCore/qmap.h>
#include <QtCore/qurl.h>
#include <QtCore/qdir.h>
Expand Down
3 changes: 0 additions & 3 deletions src/plugins/sqldrivers/mysql/qsql_mysql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
#include <qsqlquery.h>
#include <qsqlrecord.h>
#include <qstringlist.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h>
#endif
#include <qvector.h>
#include <qfile.h>
#include <qdebug.h>
Expand Down
1 change: 0 additions & 1 deletion src/tools/uic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <qdir.h>
#include <qhashfunctions.h>
#include <qtextstream.h>
#include <qtextcodec.h>
#include <qcoreapplication.h>
#include <qcommandlineoption.h>
#include <qcommandlineparser.h>
Expand Down
9 changes: 1 addition & 8 deletions src/xml/dom/qdom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
#if QT_CONFIG(regularexpression)
#include <qregularexpression.h>
#endif
#if QT_CONFIG(textcodec)
#include <qtextcodec.h>
#endif
#include <qtextstream.h>
#include <qxml.h>
#include <qvariant.h>
Expand Down Expand Up @@ -5942,7 +5939,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
const QDomNodePrivate* n = first;

if(encUsed == QDomNode::EncodingFromDocument) {
#if QT_CONFIG(textcodec) && QT_CONFIG(regularexpression)
#if QT_CONFIG(regularexpression)
const QDomNodePrivate* n = first;

if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
Expand Down Expand Up @@ -5977,11 +5974,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
else {

// Write out the XML declaration.
#if !QT_CONFIG(textcodec)
const QLatin1String codecName("UTF-8");
#else
const QByteArray codecName = QStringConverter::nameForEncoding(s.encoding());
#endif

s << "<?xml version=\"1.0\" encoding=\""
<< codecName
Expand Down
11 changes: 1 addition & 10 deletions src/xml/sax/qxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@

#include "qxml.h"
#include "qxml_p.h"
#if QT_CONFIG(textcodec)
#include "qtextcodec.h"
#endif
#include "qbuffer.h"
#include "qstringconverter.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h"
#endif
Expand Down Expand Up @@ -1301,7 +1299,6 @@ void QXmlInputSource::fetchData()
}
}

#if QT_CONFIG(textcodec)
static QString extractEncodingDecl(const QString &text, bool *needMoreText)
{
*needMoreText = false;
Expand Down Expand Up @@ -1343,7 +1340,6 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)

return encoding;
}
#endif // textcodec

/*!
This function reads the XML file from \a data and tries to
Expand All @@ -1358,10 +1354,6 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
*/
QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
{
#if !QT_CONFIG(textcodec)
Q_UNUSED(beginning);
return QString::fromLatin1(data.constData(), data.size());
#else
if (data.size() == 0)
return QString();
if (beginning) {
Expand Down Expand Up @@ -1443,7 +1435,6 @@ QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
}

return input;
#endif
}


Expand Down
1 change: 0 additions & 1 deletion tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <qfile.h>
#include <qdir.h>
#include <qset.h>
#include <qtextcodec.h>
#include <QtTest/private/qtesthelpers_p.h>
#ifdef Q_OS_WIN
# include <windows.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <qdatetime.h>
#include <qdir.h>
#include <qset.h>
#include <qtextcodec.h>

#include <QtTest/private/qtesthelpers_p.h>

Expand Down
1 change: 0 additions & 1 deletion tests/auto/corelib/io/qurl/tst_qurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <qcoreapplication.h>

#include <qfileinfo.h>
#include <qtextcodec.h>
#include <qmap.h>

Q_DECLARE_METATYPE(QUrl::FormattingOptions)
Expand Down
1 change: 0 additions & 1 deletion tests/auto/corelib/text/qlocale/tst_qlocale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <qdir.h>
#include <qfileinfo.h>
#include <QScopedArrayPointer>
#include <qtextcodec.h>
#include <qdatetime.h>
#if QT_CONFIG(process)
# include <qprocess.h>
Expand Down
2 changes: 0 additions & 2 deletions tests/auto/corelib/text/qstring/tst_qstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <QtTest/QtTest>
#include <qregexp.h>
#include <qregularexpression.h>
#include <qtextcodec.h>
#include <qtextstream.h>
#include <qstringlist.h>
#include <qstringmatcher.h>
Expand Down Expand Up @@ -4184,7 +4183,6 @@ void tst_QString::stringRef_utf8()
QCOMPARE( utf8, QByteArray(ref.toUtf8()) );
}

// copied to tst_QTextCodec::utf8Codec_data()
void tst_QString::fromUtf8_data()
{
QTest::addColumn<QByteArray>("utf8");
Expand Down

0 comments on commit 2b8863a

Please sign in to comment.