Merge remote-tracking branch 'origin/5.11' into 5.12

Conflicts:
	.qmake.conf
	qmake/Makefile.unix
	src/gui/text/qtextdocument.cpp
	src/gui/text/qtextdocument.h

Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
This commit is contained in:
Liang Qi 2018-11-09 10:34:33 +01:00
commit bc07958f92
73 changed files with 237 additions and 225 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -24,5 +24,9 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_NM = $${CROSS_COMPILE}nm -P
QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_STRIP = $${CROSS_COMPILE}strip
# modifications to gcc-base.conf
QMAKE_AR_LTCG = $${CROSS_COMPILE}gcc-ar cqs
QMAKE_NM_LTCG = $${CROSS_COMPILE}gcc-nm -P
contains(DISTRO_OPTS, deb-multi-arch): \ contains(DISTRO_OPTS, deb-multi-arch): \
QMAKE_PKG_CONFIG = $${CROSS_COMPILE}pkg-config QMAKE_PKG_CONFIG = $${CROSS_COMPILE}pkg-config

View File

@ -17,7 +17,7 @@ OBJS = \
#qt code (please keep in order matching DEPEND_SRC) #qt code (please keep in order matching DEPEND_SRC)
QOBJS = \ QOBJS = \
qtextcodec.o qutfcodec.o \ qutfcodec.o \
qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o \ qendian.o qglobal.o qlogging.o qmalloc.o qnumeric.o qoperatingsystemversion.o qrandom.o \
qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o \ qabstractfileengine.o qbuffer.o qdatastream.o qdebug.o \
qdir.o qdiriterator.o \ qdir.o qdiriterator.o \
@ -66,7 +66,6 @@ DEPEND_SRC = \
$(QMKGENSRC)/win32/msvc_vcxproj.cpp \ $(QMKGENSRC)/win32/msvc_vcxproj.cpp \
$(QMKGENSRC)/win32/winmakefile.cpp \ $(QMKGENSRC)/win32/winmakefile.cpp \
$(QMKGENSRC)/xmloutput.cpp \ $(QMKGENSRC)/xmloutput.cpp \
$(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp \
$(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \ $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp \
$(SOURCE_PATH)/src/corelib/global/qendian.cpp \ $(SOURCE_PATH)/src/corelib/global/qendian.cpp \
$(SOURCE_PATH)/src/corelib/global/qglobal.cpp \ $(SOURCE_PATH)/src/corelib/global/qglobal.cpp \
@ -341,9 +340,6 @@ qcore_foundation.o: $(SOURCE_PATH)/src/corelib/kernel/qcore_foundation.mm
qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp qutfcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qutfcodec.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<
qtextcodec.o: $(SOURCE_PATH)/src/corelib/codecs/qtextcodec.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp qstring.o: $(SOURCE_PATH)/src/corelib/tools/qstring.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $< $(CXX) -c -o $@ $(CXXFLAGS) $<

View File

@ -100,7 +100,6 @@ QTOBJS= \
qoperatingsystemversion.obj \ qoperatingsystemversion.obj \
qoperatingsystemversion_win.obj \ qoperatingsystemversion_win.obj \
qregexp.obj \ qregexp.obj \
qtextcodec.obj \
qutfcodec.obj \ qutfcodec.obj \
qstring.obj \ qstring.obj \
qstring_compat.obj \ qstring_compat.obj \

View File

@ -35,7 +35,7 @@ using namespace QMakeInternal;
#include <qfile.h> #include <qfile.h>
#include <qfileinfo.h> #include <qfileinfo.h>
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif #endif
@ -49,7 +49,7 @@ QMakeVfs::QMakeVfs()
, m_magicExisting(fL1S("existing")) , m_magicExisting(fL1S("existing"))
#endif #endif
{ {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
m_textCodec = 0; m_textCodec = 0;
#endif #endif
ref(); ref();
@ -236,7 +236,7 @@ QMakeVfs::ReadResult QMakeVfs::readFile(int id, QString *contents, QString *errS
return ReadOtherError; return ReadOtherError;
} }
*contents = *contents =
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
m_textCodec ? m_textCodec->toUnicode(bcont) : m_textCodec ? m_textCodec->toUnicode(bcont) :
#endif #endif
QString::fromLocal8Bit(bcont); QString::fromLocal8Bit(bcont);
@ -290,7 +290,7 @@ void QMakeVfs::invalidateContents()
} }
#endif #endif
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void QMakeVfs::setTextCodec(const QTextCodec *textCodec) void QMakeVfs::setTextCodec(const QTextCodec *textCodec)
{ {
m_textCodec = textCodec; m_textCodec = textCodec;

View File

@ -38,7 +38,7 @@
# include <qmutex.h> # include <qmutex.h>
#endif #endif
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QT_FORWARD_DECLARE_CLASS(QTextCodec) QT_FORWARD_DECLARE_CLASS(QTextCodec)
#endif #endif
@ -92,7 +92,7 @@ public:
void invalidateContents(); void invalidateContents();
#endif #endif
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void setTextCodec(const QTextCodec *textCodec); void setTextCodec(const QTextCodec *textCodec);
#endif #endif
@ -129,7 +129,7 @@ private:
QString m_magicMissing; QString m_magicMissing;
QString m_magicExisting; QString m_magicExisting;
#endif #endif
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
const QTextCodec *m_textCodec; const QTextCodec *m_textCodec;
#endif #endif
}; };

View File

@ -152,7 +152,6 @@ SOURCES += \
qstringlist.cpp \ qstringlist.cpp \
qsystemerror.cpp \ qsystemerror.cpp \
qtemporaryfile.cpp \ qtemporaryfile.cpp \
qtextcodec.cpp \
qtextstream.cpp \ qtextstream.cpp \
qutfcodec.cpp \ qutfcodec.cpp \
quuid.cpp \ quuid.cpp \
@ -204,7 +203,6 @@ HEADERS += \
qstringmatcher.h \ qstringmatcher.h \
qsystemerror_p.h \ qsystemerror_p.h \
qtemporaryfile.h \ qtemporaryfile.h \
qtextcodec.h \
qtextstream.h \ qtextstream.h \
qutfcodec.h \ qutfcodec.h \
quuid.h \ quuid.h \

View File

@ -1,62 +1,68 @@
# Qt core library codecs module # Qt core library codecs module
HEADERS += \ HEADERS += \
codecs/qlatincodec_p.h \
codecs/qsimplecodec_p.h \
codecs/qtextcodec_p.h \ codecs/qtextcodec_p.h \
codecs/qtextcodec.h \
codecs/qutfcodec_p.h codecs/qutfcodec_p.h
SOURCES += \ SOURCES += \
codecs/qlatincodec.cpp \
codecs/qsimplecodec.cpp \
codecs/qtextcodec.cpp \
codecs/qutfcodec.cpp codecs/qutfcodec.cpp
qtConfig(codecs) { qtConfig(textcodec) {
HEADERS += \ HEADERS += \
codecs/qisciicodec_p.h \ codecs/qlatincodec_p.h \
codecs/qtsciicodec_p.h codecs/qsimplecodec_p.h \
codecs/qtextcodec.h
SOURCES += \ SOURCES += \
codecs/qisciicodec.cpp \ codecs/qlatincodec.cpp \
codecs/qtsciicodec.cpp codecs/qsimplecodec.cpp \
} codecs/qtextcodec.cpp
qtConfig(icu) { qtConfig(codecs) {
HEADERS += \
codecs/qicucodec_p.h
SOURCES += \
codecs/qicucodec.cpp
} else {
qtConfig(big_codecs) {
HEADERS += \ HEADERS += \
codecs/qgb18030codec_p.h \ codecs/qisciicodec_p.h \
codecs/qeucjpcodec_p.h \ codecs/qtsciicodec_p.h
codecs/qjiscodec_p.h \
codecs/qsjiscodec_p.h \
codecs/qeuckrcodec_p.h \
codecs/qbig5codec_p.h
SOURCES += \ SOURCES += \
codecs/qgb18030codec.cpp \ codecs/qisciicodec.cpp \
codecs/qjpunicode.cpp \ codecs/qtsciicodec.cpp
codecs/qeucjpcodec.cpp \
codecs/qjiscodec.cpp \
codecs/qsjiscodec.cpp \
codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp
} }
qtConfig(iconv) { qtConfig(icu) {
HEADERS += codecs/qiconvcodec_p.h HEADERS += \
SOURCES += codecs/qiconvcodec.cpp codecs/qicucodec_p.h
qtConfig(gnu-libiconv): \ SOURCES += \
QMAKE_USE_PRIVATE += iconv codecs/qicucodec.cpp
} } else {
qtConfig(big_codecs) {
HEADERS += \
codecs/qgb18030codec_p.h \
codecs/qeucjpcodec_p.h \
codecs/qjiscodec_p.h \
codecs/qsjiscodec_p.h \
codecs/qeuckrcodec_p.h \
codecs/qbig5codec_p.h
win32 { SOURCES += \
SOURCES += codecs/qwindowscodec.cpp codecs/qgb18030codec.cpp \
HEADERS += codecs/qwindowscodec_p.h codecs/qjpunicode.cpp \
codecs/qeucjpcodec.cpp \
codecs/qjiscodec.cpp \
codecs/qsjiscodec.cpp \
codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp
}
qtConfig(iconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
qtConfig(gnu-libiconv): \
QMAKE_USE_PRIVATE += iconv
}
win32 {
SOURCES += codecs/qwindowscodec.cpp
HEADERS += codecs/qwindowscodec_p.h
}
} }
} }

View File

@ -39,8 +39,6 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
QT_REQUIRE_CONFIG(iconv);
#include "qiconvcodec_p.h" #include "qiconvcodec_p.h"
#include "qtextcodec_p.h" #include "qtextcodec_p.h"
#include <qdebug.h> #include <qdebug.h>

View File

@ -39,8 +39,6 @@
#include "qicucodec_p.h" #include "qicucodec_p.h"
#ifndef QT_NO_TEXTCODEC
#include "qtextcodec_p.h" #include "qtextcodec_p.h"
#include "qutfcodec_p.h" #include "qutfcodec_p.h"
#include "qlatincodec_p.h" #include "qlatincodec_p.h"
@ -698,5 +696,3 @@ int QIcuCodec::mibEnum() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TEXTCODEC

View File

@ -59,9 +59,9 @@ extern "C" {
typedef struct UConverter UConverter; typedef struct UConverter UConverter;
} }
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(textcodec);
#ifndef QT_NO_TEXTCODEC QT_BEGIN_NAMESPACE
class QIcuCodec : public QTextCodec class QIcuCodec : public QTextCodec
{ {
@ -90,8 +90,6 @@ private:
const char *m_name; const char *m_name;
}; };
#endif // QT_NO_TEXTCODEC
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif

View File

@ -40,8 +40,6 @@
#include "qlatincodec_p.h" #include "qlatincodec_p.h"
#include "qlist.h" #include "qlist.h"
#ifndef QT_NO_TEXTCODEC
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QLatin1Codec::~QLatin1Codec() QLatin1Codec::~QLatin1Codec()
@ -238,5 +236,3 @@ int QLatin15Codec::mibEnum() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TEXTCODEC

View File

@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h" #include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(textcodec);
#ifndef QT_NO_TEXTCODEC QT_BEGIN_NAMESPACE
class QLatin1Codec : public QTextCodec class QLatin1Codec : public QTextCodec
{ {
@ -86,8 +86,6 @@ public:
int mibEnum() const override; int mibEnum() const override;
}; };
#endif // QT_NO_TEXTCODEC
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QLATINCODEC_P_H #endif // QLATINCODEC_P_H

View File

@ -40,8 +40,6 @@
#include "qsimplecodec_p.h" #include "qsimplecodec_p.h"
#include "qlist.h" #include "qlist.h"
#ifndef QT_NO_TEXTCODEC
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define LAST_MIB 2004 #define LAST_MIB 2004
@ -724,5 +722,3 @@ int QSimpleTextCodec::mibEnum() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TEXTCODEC

View File

@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h" #include "QtCore/qtextcodec.h"
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(textcodec);
#ifndef QT_NO_TEXTCODEC QT_BEGIN_NAMESPACE
template <typename T> class QAtomicPointer; template <typename T> class QAtomicPointer;
@ -79,8 +79,6 @@ private:
mutable QAtomicPointer<QByteArray> reverseMap; mutable QAtomicPointer<QByteArray> reverseMap;
}; };
#endif // QT_NO_TEXTCODEC
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QSIMPLECODEC_P_H #endif // QSIMPLECODEC_P_H

View File

@ -39,11 +39,10 @@
****************************************************************************/ ****************************************************************************/
#include "qplatformdefs.h" #include "qplatformdefs.h"
#include "qtextcodec.h" #include "qtextcodec.h"
#include "qtextcodec_p.h" #include "qtextcodec_p.h"
#ifndef QT_NO_TEXTCODEC
#include "qbytearraymatcher.h" #include "qbytearraymatcher.h"
#include "qendian.h" #include "qendian.h"
#include "qfile.h" #include "qfile.h"
@ -1274,5 +1273,3 @@ bool QTextDecoder::needsMoreData() const
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_TEXTCODEC

View File

@ -43,11 +43,10 @@
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
QT_REQUIRE_CONFIG(textcodec);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTCODEC
class QTextCodec; class QTextCodec;
class QIODevice; class QIODevice;
@ -168,8 +167,6 @@ private:
QTextCodec::ConverterState state; QTextCodec::ConverterState state;
}; };
#endif // QT_NO_TEXTCODEC
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QTEXTCODEC_H #endif // QTEXTCODEC_H

View File

@ -52,12 +52,13 @@
// //
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h"
#include <string.h> #include <string.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
#include "qtextcodec.h"
#if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WASM) #if defined(Q_OS_MAC) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WASM)
#define QT_LOCALE_IS_UTF8 #define QT_LOCALE_IS_UTF8
@ -82,7 +83,7 @@ struct QTextCodecUnalignedPointer
bool qTextCodecNameMatch(const char *a, const char *b); bool qTextCodecNameMatch(const char *a, const char *b);
#else #else // without textcodec:
class QTextCodec class QTextCodec
{ {
@ -109,7 +110,7 @@ public:
}; };
}; };
#endif //QT_NO_TEXTCODEC #endif // textcodec
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -972,7 +972,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QUtf8Codec::~QUtf8Codec() QUtf8Codec::~QUtf8Codec()
{ {
@ -1126,6 +1126,6 @@ QList<QByteArray> QUtf32LECodec::aliases() const
return list; return list;
} }
#endif //QT_NO_TEXTCODEC #endif // textcodec
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -52,7 +52,13 @@
// We mean it. // We mean it.
// //
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
#if QT_CONFIG(textcodec)
#include "QtCore/qtextcodec.h" #include "QtCore/qtextcodec.h"
#endif
#include "private/qtextcodec_p.h" #include "private/qtextcodec_p.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -311,7 +317,7 @@ struct QUtf32
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness); static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
}; };
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
class QUtf8Codec : public QTextCodec { class QUtf8Codec : public QTextCodec {
public: public:
@ -391,7 +397,7 @@ public:
}; };
#endif // QT_NO_TEXTCODEC #endif // textcodec
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -53,6 +53,8 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h" #include "qtextcodec.h"
QT_REQUIRE_CONFIG(textcodec);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QWindowsLocalCodec: public QTextCodec class QWindowsLocalCodec: public QTextCodec

View File

@ -128,7 +128,6 @@
#define QT_NO_COMPRESS #define QT_NO_COMPRESS
#define QT_JSON_READONLY #define QT_JSON_READONLY
#define QT_NO_STANDARDPATHS #define QT_NO_STANDARDPATHS
#define QT_NO_TEXTCODEC
#define QT_FEATURE_textcodec -1 #define QT_FEATURE_textcodec -1
#else #else
#define QT_FEATURE_codecs -1 #define QT_FEATURE_codecs -1

View File

@ -66,5 +66,7 @@
#include <qregexp.h> #include <qregexp.h>
#include <qstring.h> #include <qstring.h>
#include <qstringlist.h> #include <qstringlist.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif #endif
#endif

View File

@ -54,7 +54,7 @@
#include "qstandardpaths.h" #include "qstandardpaths.h"
#include <qdatastream.h> #include <qdatastream.h>
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
# include "qtextcodec.h" # include "qtextcodec.h"
#endif #endif
@ -681,7 +681,7 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) { if (ch <= 0x1F || (ch >= 0x7F && !useCodec)) {
result += "\\x" + QByteArray::number(ch, 16); result += "\\x" + QByteArray::number(ch, 16);
escapeNextIfDigit = true; escapeNextIfDigit = true;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
} else if (useCodec) { } else if (useCodec) {
// slow // slow
result += codec->fromUnicode(&unicode[i], 1); result += codec->fromUnicode(&unicode[i], 1);
@ -834,7 +834,7 @@ StNormal:
++j; ++j;
} }
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(codec) Q_UNUSED(codec)
#else #else
if (codec) { if (codec) {
@ -1679,7 +1679,7 @@ bool QConfFileSettingsPrivate::readIniFile(const QByteArray &data,
int sectionPosition = 0; int sectionPosition = 0;
bool ok = true; bool ok = true;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
// detect utf8 BOM // detect utf8 BOM
const uchar *dd = (const uchar *)data.constData(); const uchar *dd = (const uchar *)data.constData();
if (data.size() >= 3 && dd[0] == 0xef && dd[1] == 0xbb && dd[2] == 0xbf) { if (data.size() >= 3 && dd[0] == 0xef && dd[1] == 0xbb && dd[2] == 0xbf) {
@ -2835,7 +2835,7 @@ QString QSettings::applicationName() const
return d->applicationName; return d->applicationName;
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
/*! /*!
\since 4.5 \since 4.5
@ -2888,7 +2888,7 @@ QTextCodec *QSettings::iniCodec() const
return d->iniCodec; return d->iniCodec;
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
/*! /*!
Returns a status code indicating the first error that was met by Returns a status code indicating the first error that was met by

View File

@ -178,7 +178,7 @@ public:
QString organizationName() const; QString organizationName() const;
QString applicationName() const; QString applicationName() const;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void setIniCodec(QTextCodec *codec); void setIniCodec(QTextCodec *codec);
void setIniCodec(const char *codecName); void setIniCodec(const char *codecName);
QTextCodec *iniCodec() const; QTextCodec *iniCodec() const;

View File

@ -55,7 +55,6 @@
#include <qmutex.h> #include <qmutex.h>
#include <private/qloggingregistry_p.h> #include <private/qloggingregistry_p.h>
#include <qstandardpaths.h> #include <qstandardpaths.h>
#include <qtextcodec.h>
#ifndef QT_NO_QOBJECT #ifndef QT_NO_QOBJECT
#include <qthread.h> #include <qthread.h>
#include <qthreadstorage.h> #include <qthreadstorage.h>

View File

@ -38,7 +38,9 @@
****************************************************************************/ ****************************************************************************/
#include "qcoreglobaldata_p.h" #include "qcoreglobaldata_p.h"
#if QT_CONFIG(textcodec)
#include "qtextcodec.h" #include "qtextcodec.h"
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -57,7 +57,9 @@
#include "QtCore/qreadwritelock.h" #include "QtCore/qreadwritelock.h"
#include "QtCore/qhash.h" #include "QtCore/qhash.h"
#include "QtCore/qbytearray.h" #include "QtCore/qbytearray.h"
#if QT_CONFIG(textcodec)
#include "QtCore/qtextcodec.h" #include "QtCore/qtextcodec.h"
#endif
#include "QtCore/qmutex.h" #include "QtCore/qmutex.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -42,7 +42,9 @@
#include "private/qobject_p.h" #include "private/qobject_p.h"
#include "qurl.h" #include "qurl.h"
#include "qstringlist.h" #include "qstringlist.h"
#if QT_CONFIG(textcodec)
#include "qtextcodec.h" #include "qtextcodec.h"
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -150,7 +152,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
if (data.type() == QVariant::ByteArray) { if (data.type() == QVariant::ByteArray) {
// see if we can convert to the requested type // see if we can convert to the requested type
switch(type) { switch(type) {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
case QVariant::String: { case QVariant::String: {
const QByteArray ba = data.toByteArray(); const QByteArray ba = data.toByteArray();
QTextCodec *codec = QTextCodec::codecForName("utf-8"); QTextCodec *codec = QTextCodec::codecForName("utf-8");
@ -158,7 +160,7 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
codec = QTextCodec::codecForHtml(ba, codec); codec = QTextCodec::codecForHtml(ba, codec);
return codec->toUnicode(ba); return codec->toUnicode(ba);
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
case QVariant::Color: { case QVariant::Color: {
QVariant newData = data; QVariant newData = data;
newData.convert(QVariant::Color); newData.convert(QVariant::Color);

View File

@ -326,7 +326,7 @@ QT_BEGIN_NAMESPACE
*/ */
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr) QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
: :
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
readConverterSavedState(0), readConverterSavedState(0),
#endif #endif
readConverterSavedStateOffset(0), readConverterSavedStateOffset(0),
@ -347,12 +347,12 @@ QTextStreamPrivate::~QTextStreamPrivate()
#endif #endif
delete device; delete device;
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
delete readConverterSavedState; delete readConverterSavedState;
#endif #endif
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state) static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
{ {
state->~ConverterState(); state->~ConverterState();
@ -401,7 +401,7 @@ void QTextStreamPrivate::reset()
readBufferStartDevicePos = 0; readBufferStartDevicePos = 0;
lastTokenSize = 0; lastTokenSize = 0;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
codec = QTextCodec::codecForLocale(); codec = QTextCodec::codecForLocale();
resetCodecConverterStateHelper(&readConverterState); resetCodecConverterStateHelper(&readConverterState);
resetCodecConverterStateHelper(&writeConverterState); resetCodecConverterStateHelper(&writeConverterState);
@ -461,7 +461,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
if (bytesRead <= 0) if (bytesRead <= 0)
return false; return false;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
// codec auto detection, explicitly defaults to locale encoding if the // codec auto detection, explicitly defaults to locale encoding if the
// codec has been set to 0. // codec has been set to 0.
if (!codec || autoDetectUnicode) { if (!codec || autoDetectUnicode) {
@ -485,7 +485,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
#endif #endif
int oldReadBufferSize = readBuffer.size(); int oldReadBufferSize = readBuffer.size();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
// convert to unicode // convert to unicode
readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState) readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
: QString::fromLatin1(buf, bytesRead); : QString::fromLatin1(buf, bytesRead);
@ -567,7 +567,7 @@ void QTextStreamPrivate::flushWriteBuffer()
} }
#endif #endif
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (!codec) if (!codec)
codec = QTextCodec::codecForLocale(); codec = QTextCodec::codecForLocale();
#if defined (QTEXTSTREAM_DEBUG) #if defined (QTEXTSTREAM_DEBUG)
@ -786,7 +786,7 @@ inline void QTextStreamPrivate::consume(int size)
*/ */
inline void QTextStreamPrivate::saveConverterState(qint64 newPos) inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
{ {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (readConverterState.d) { if (readConverterState.d) {
// converter cannot be copied, so don't save anything // converter cannot be copied, so don't save anything
// don't update readBufferStartDevicePos either // don't update readBufferStartDevicePos either
@ -807,7 +807,7 @@ inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
*/ */
inline void QTextStreamPrivate::restoreToSavedConverterState() inline void QTextStreamPrivate::restoreToSavedConverterState()
{ {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (readConverterSavedState) { if (readConverterSavedState) {
// we have a saved state // we have a saved state
// that means the converter can be copied // that means the converter can be copied
@ -1202,7 +1202,7 @@ bool QTextStream::seek(qint64 pos)
return false; return false;
d->resetReadBuffer(); d->resetReadBuffer();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
// Reset the codec converter states. // Reset the codec converter states.
resetCodecConverterStateHelper(&d->readConverterState); resetCodecConverterStateHelper(&d->readConverterState);
resetCodecConverterStateHelper(&d->writeConverterState); resetCodecConverterStateHelper(&d->writeConverterState);
@ -1253,7 +1253,7 @@ qint64 QTextStream::pos() const
QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d); QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);
thatd->readBuffer.clear(); thatd->readBuffer.clear();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
thatd->restoreToSavedConverterState(); thatd->restoreToSavedConverterState();
if (d->readBufferStartDevicePos == 0) if (d->readBufferStartDevicePos == 0)
thatd->autoDetectUnicode = true; thatd->autoDetectUnicode = true;
@ -3036,7 +3036,7 @@ QTextStream &ws(QTextStream &stream)
Equivalent to QTextStream::setRealNumberPrecision(\a precision). Equivalent to QTextStream::setRealNumberPrecision(\a precision).
*/ */
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
/*! /*!
\relates QTextStream \relates QTextStream

View File

@ -98,7 +98,7 @@ public:
explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly); explicit QTextStream(const QByteArray &array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
virtual ~QTextStream(); virtual ~QTextStream();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void setCodec(QTextCodec *codec); void setCodec(QTextCodec *codec);
void setCodec(const char *codecName); void setCodec(const char *codecName);
QTextCodec *codec() const; QTextCodec *codec() const;

View File

@ -54,7 +54,7 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
#include "qtextstream.h" #include "qtextstream.h"
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
#include "qtextcodec.h" #include "qtextcodec.h"
#endif #endif
@ -118,7 +118,7 @@ public:
int stringOffset; int stringOffset;
QIODevice::OpenMode stringOpenMode; QIODevice::OpenMode stringOpenMode;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
// codec // codec
QTextCodec *codec; QTextCodec *codec;
QTextCodec::ConverterState readConverterState; QTextCodec::ConverterState readConverterState;
@ -141,7 +141,7 @@ public:
int lastTokenSize; int lastTokenSize;
bool deleteDevice; bool deleteDevice;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
bool autoDetectUnicode; bool autoDetectUnicode;
#endif #endif

View File

@ -45,7 +45,9 @@
#include <qdebug.h> #include <qdebug.h>
#include <qfile.h> #include <qfile.h>
#include <stdio.h> #include <stdio.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qstack.h> #include <qstack.h>
#include <qbuffer.h> #include <qbuffer.h>
#ifndef QT_BOOTSTRAPPED #ifndef QT_BOOTSTRAPPED
@ -420,7 +422,7 @@ QXmlStreamReader::QXmlStreamReader(const QString &data)
: d_ptr(new QXmlStreamReaderPrivate(this)) : d_ptr(new QXmlStreamReaderPrivate(this))
{ {
Q_D(QXmlStreamReader); Q_D(QXmlStreamReader);
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
d->dataBuffer = data.toLatin1(); d->dataBuffer = data.toLatin1();
#else #else
d->dataBuffer = d->codec->fromUnicode(data); d->dataBuffer = d->codec->fromUnicode(data);
@ -515,7 +517,7 @@ void QXmlStreamReader::addData(const QString &data)
{ {
Q_D(QXmlStreamReader); Q_D(QXmlStreamReader);
d->lockEncoding = true; d->lockEncoding = true;
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
addData(data.toLatin1()); addData(data.toLatin1());
#else #else
addData(d->codec->fromUnicode(data)); addData(d->codec->fromUnicode(data));
@ -792,7 +794,7 @@ QXmlStreamReaderPrivate::QXmlStreamReaderPrivate(QXmlStreamReader *q)
{ {
device = 0; device = 0;
deleteDevice = false; deleteDevice = false;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
decoder = 0; decoder = 0;
#endif #endif
stack_size = 64; stack_size = 64;
@ -838,7 +840,7 @@ void QXmlStreamReaderPrivate::init()
lineNumber = lastLineStart = characterOffset = 0; lineNumber = lastLineStart = characterOffset = 0;
readBufferPos = 0; readBufferPos = 0;
nbytesread = 0; nbytesread = 0;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
codec = QTextCodec::codecForMib(106); // utf8 codec = QTextCodec::codecForMib(106); // utf8
delete decoder; delete decoder;
decoder = 0; decoder = 0;
@ -903,7 +905,7 @@ inline void QXmlStreamReaderPrivate::reallocateStack()
QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate() QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
{ {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
delete decoder; delete decoder;
#endif #endif
free(sym_stack); free(sym_stack);
@ -1482,7 +1484,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
characterOffset += readBufferPos; characterOffset += readBufferPos;
readBufferPos = 0; readBufferPos = 0;
readBuffer.resize(0); readBuffer.resize(0);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (decoder) if (decoder)
#endif #endif
nbytesread = 0; nbytesread = 0;
@ -1503,7 +1505,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
return StreamEOF; return StreamEOF;
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (!decoder) { if (!decoder) {
if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus
// one extra for the utf8 codec // one extra for the utf8 codec
@ -1545,7 +1547,7 @@ uint QXmlStreamReaderPrivate::getChar_helper()
} }
#else #else
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread); readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
#endif // QT_NO_TEXTCODEC #endif // textcodec
readBuffer.reserve(1); // keep capacity when calling resize() next time readBuffer.reserve(1); // keep capacity when calling resize() next time
@ -1816,7 +1818,7 @@ void QXmlStreamReaderPrivate::startDocument()
if (!QXmlUtils::isEncName(value)) if (!QXmlUtils::isEncName(value))
err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value); err = QXmlStream::tr("%1 is an invalid encoding name.").arg(value);
else { else {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread); readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
#else #else
QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1()); QTextCodec *const newCodec = QTextCodec::codecForName(value.toLatin1());
@ -1828,7 +1830,7 @@ void QXmlStreamReaderPrivate::startDocument()
decoder = codec->makeDecoder(); decoder = codec->makeDecoder();
decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread); decoder->toUnicode(&readBuffer, rawReadBuffer.data(), nbytesread);
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
} }
} else if (prefix.isEmpty() && key == QLatin1String("standalone")) { } else if (prefix.isEmpty() && key == QLatin1String("standalone")) {
hasStandalone = true; hasStandalone = true;
@ -2966,7 +2968,7 @@ public:
~QXmlStreamWriterPrivate() { ~QXmlStreamWriterPrivate() {
if (deleteDevice) if (deleteDevice)
delete device; delete device;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
delete encoder; delete encoder;
#endif #endif
} }
@ -2993,7 +2995,7 @@ public:
NamespaceDeclaration emptyNamespace; NamespaceDeclaration emptyNamespace;
int lastNamespaceDeclaration; int lastNamespaceDeclaration;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *codec; QTextCodec *codec;
QTextEncoder *encoder; QTextEncoder *encoder;
#endif #endif
@ -3015,7 +3017,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
device = 0; device = 0;
stringDevice = 0; stringDevice = 0;
deleteDevice = false; deleteDevice = false;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
codec = QTextCodec::codecForMib(106); // utf8 codec = QTextCodec::codecForMib(106); // utf8
encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8 encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8
#endif #endif
@ -3032,7 +3034,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec() void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
{ {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
Q_ASSERT(encoder); Q_ASSERT(encoder);
// test ASCII-compatibility using the letter 'a' // test ASCII-compatibility using the letter 'a'
QChar letterA = QLatin1Char('a'); QChar letterA = QLatin1Char('a');
@ -3052,7 +3054,7 @@ void QXmlStreamWriterPrivate::write(const QStringRef &s)
if (device) { if (device) {
if (hasIoError) if (hasIoError)
return; return;
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
QByteArray bytes = s.toLatin1(); QByteArray bytes = s.toLatin1();
#else #else
QByteArray bytes = encoder->fromUnicode(s.constData(), s.size()); QByteArray bytes = encoder->fromUnicode(s.constData(), s.size());
@ -3075,7 +3077,7 @@ void QXmlStreamWriterPrivate::write(const QString &s)
if (device) { if (device) {
if (hasIoError) if (hasIoError)
return; return;
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
QByteArray bytes = s.toLatin1(); QByteArray bytes = s.toLatin1();
#else #else
QByteArray bytes = encoder->fromUnicode(s); QByteArray bytes = encoder->fromUnicode(s);
@ -3324,7 +3326,7 @@ QIODevice *QXmlStreamWriter::device() const
} }
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
/*! /*!
Sets the codec for this stream to \a codec. The codec is used for Sets the codec for this stream to \a codec. The codec is used for
encoding any data that is written. By default, QXmlStreamWriter encoding any data that is written. By default, QXmlStreamWriter
@ -3382,7 +3384,7 @@ QTextCodec *QXmlStreamWriter::codec() const
Q_D(const QXmlStreamWriter); Q_D(const QXmlStreamWriter);
return d->codec; return d->codec;
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
/*! /*!
\property QXmlStreamWriter::autoFormatting \property QXmlStreamWriter::autoFormatting
@ -3847,7 +3849,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version)
d->write(version); d->write(version);
if (d->device) { // stringDevice does not get any encoding if (d->device) { // stringDevice does not get any encoding
d->write("\" encoding=\""); d->write("\" encoding=\"");
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
d->write("iso-8859-1"); d->write("iso-8859-1");
#else #else
const QByteArray name = d->codec->name(); const QByteArray name = d->codec->name();
@ -3871,7 +3873,7 @@ void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalon
d->write(version); d->write(version);
if (d->device) { // stringDevice does not get any encoding if (d->device) { // stringDevice does not get any encoding
d->write("\" encoding=\""); d->write("\" encoding=\"");
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
d->write("iso-8859-1"); d->write("iso-8859-1");
#else #else
const QByteArray name = d->codec->name(); const QByteArray name = d->codec->name();

View File

@ -291,7 +291,7 @@ public:
QIODevice *device; QIODevice *device;
bool deleteDevice; bool deleteDevice;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *codec; QTextCodec *codec;
QTextDecoder *decoder; QTextDecoder *decoder;
#endif #endif
@ -584,7 +584,7 @@ bool QXmlStreamReaderPrivate::parse()
lockEncoding = true; lockEncoding = true;
documentVersion.clear(); documentVersion.clear();
documentEncoding.clear(); documentEncoding.clear();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (decoder && decoder->hasFailure()) { if (decoder && decoder->hasFailure()) {
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
readBuffer.clear(); readBuffer.clear();

View File

@ -478,7 +478,7 @@ public:
void setDevice(QIODevice *device); void setDevice(QIODevice *device);
QIODevice *device() const; QIODevice *device() const;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void setCodec(QTextCodec *codec); void setCodec(QTextCodec *codec);
void setCodec(const char *codecName); void setCodec(const char *codecName);
QTextCodec *codec() const; QTextCodec *codec() const;

View File

@ -788,7 +788,7 @@ public:
QIODevice *device; QIODevice *device;
bool deleteDevice; bool deleteDevice;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *codec; QTextCodec *codec;
QTextDecoder *decoder; QTextDecoder *decoder;
#endif #endif
@ -1081,7 +1081,7 @@ bool QXmlStreamReaderPrivate::parse()
lockEncoding = true; lockEncoding = true;
documentVersion.clear(); documentVersion.clear();
documentEncoding.clear(); documentEncoding.clear();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (decoder && decoder->hasFailure()) { if (decoder && decoder->hasFailure()) {
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
readBuffer.clear(); readBuffer.clear();

View File

@ -44,7 +44,7 @@
#include "qregularexpression.h" #include "qregularexpression.h"
#endif #endif
#include "qunicodetables_p.h" #include "qunicodetables_p.h"
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif #endif
#include <private/qutfcodec_p.h> #include <private/qutfcodec_p.h>
@ -5277,11 +5277,11 @@ static QByteArray qt_convert_to_local_8bit(QStringView string)
{ {
if (string.isNull()) if (string.isNull())
return QByteArray(); return QByteArray();
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *localeCodec = QTextCodec::codecForLocale(); QTextCodec *localeCodec = QTextCodec::codecForLocale();
if (localeCodec) if (localeCodec)
return localeCodec->fromUnicode(string); return localeCodec->fromUnicode(string);
#endif // QT_NO_TEXTCODEC #endif // textcodec
return qt_convert_to_latin1(string); return qt_convert_to_latin1(string);
} }
@ -5475,13 +5475,13 @@ QString QString::fromLocal8Bit_helper(const char *str, int size)
QStringDataPtr empty = { Data::allocate(0) }; QStringDataPtr empty = { Data::allocate(0) };
return QString(empty); return QString(empty);
} }
#if !defined(QT_NO_TEXTCODEC) #if QT_CONFIG(textcodec)
if (size < 0) if (size < 0)
size = qstrlen(str); size = qstrlen(str);
QTextCodec *codec = QTextCodec::codecForLocale(); QTextCodec *codec = QTextCodec::codecForLocale();
if (codec) if (codec)
return codec->toUnicode(str, size); return codec->toUnicode(str, size);
#endif // !QT_NO_TEXTCODEC #endif // textcodec
return fromLatin1(str, size); return fromLatin1(str, size);
} }

View File

@ -38,7 +38,6 @@
****************************************************************************/ ****************************************************************************/
#include "qstringbuilder.h" #include "qstringbuilder.h"
#include <QtCore/qtextcodec.h>
#include <private/qutfcodec_p.h> #include <private/qutfcodec_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -45,7 +45,6 @@
#include <qiodevice.h> #include <qiodevice.h>
#include <qimage.h> #include <qimage.h>
#include <qlist.h> #include <qlist.h>
#include <qtextcodec.h>
#include <qvariant.h> #include <qvariant.h>
#include <qvector.h> #include <qvector.h>

View File

@ -46,7 +46,9 @@
#include "qvariant.h" #include "qvariant.h"
#include "qbuffer.h" #include "qbuffer.h"
#include "qimage.h" #include "qimage.h"
#if QT_CONFIG(textcodec)
#include "qtextcodec.h" #include "qtextcodec.h"
#endif
#include "private/qguiapplication_p.h" #include "private/qguiapplication_p.h"
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
@ -298,16 +300,16 @@ QString QClipboard::text(QString &subtype, Mode mode) const
const QByteArray rawData = data->data(QLatin1String("text/") + subtype); const QByteArray rawData = data->data(QLatin1String("text/") + subtype);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default QTextCodec* codec = QTextCodec::codecForMib(106); // utf-8 is default
if (subtype == QLatin1String("html")) if (subtype == QLatin1String("html"))
codec = QTextCodec::codecForHtml(rawData, codec); codec = QTextCodec::codecForHtml(rawData, codec);
else else
codec = QTextCodec::codecForUtfText(rawData, codec); codec = QTextCodec::codecForUtfText(rawData, codec);
return codec->toUnicode(rawData); return codec->toUnicode(rawData);
#else //QT_NO_TEXTCODEC #else // textcodec
return rawData; return rawData;
#endif //QT_NO_TEXTCODEC #endif // textcodec
} }
/*! /*!

View File

@ -44,7 +44,6 @@
#include "qpixmap.h" #include "qpixmap.h"
#include "qevent.h" #include "qevent.h"
#include "qfile.h" #include "qfile.h"
#include "qtextcodec.h"
#include "qguiapplication.h" #include "qguiapplication.h"
#include "qpoint.h" #include "qpoint.h"
#include "qbuffer.h" #include "qbuffer.h"

View File

@ -319,7 +319,8 @@ void QSurfaceFormat::setStereo(bool enable)
/*! /*!
Returns the number of samples per pixel when multisampling is Returns the number of samples per pixel when multisampling is
enabled. By default, multisampling is disabled. enabled, or \c -1 when multisampling is disabled. The default
return value is \c -1.
\sa setSamples() \sa setSamples()
*/ */

View File

@ -63,7 +63,9 @@
#include <qregexp.h> #include <qregexp.h>
#include <qstring.h> #include <qstring.h>
#include <qstringlist.h> #include <qstringlist.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qguiapplication.h> #include <qguiapplication.h>
#include <qbitmap.h> #include <qbitmap.h>

View File

@ -71,7 +71,7 @@
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 #define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#endif #endif
#ifndef GL_FRAMEBUFFER_SRB #ifndef GL_FRAMEBUFFER_SRGB
#define GL_FRAMEBUFFER_SRGB 0x8DB9 #define GL_FRAMEBUFFER_SRGB 0x8DB9
#endif #endif
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE #ifndef GL_FRAMEBUFFER_SRGB_CAPABLE

View File

@ -157,14 +157,12 @@ void QSyntaxHighlighterPrivate::applyFormatChanges()
void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded)
{ {
if (!inReformatBlocks) if (!inReformatBlocks && !rehighlightPending)
reformatBlocks(from, charsRemoved, charsAdded); reformatBlocks(from, charsRemoved, charsAdded);
} }
void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded)
{ {
rehighlightPending = false;
QTextBlock block = doc->findBlock(from); QTextBlock block = doc->findBlock(from);
if (!block.isValid()) if (!block.isValid())
return; return;
@ -346,8 +344,10 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc)
if (d->doc) { if (d->doc) {
connect(d->doc, SIGNAL(contentsChange(int,int,int)), connect(d->doc, SIGNAL(contentsChange(int,int,int)),
this, SLOT(_q_reformatBlocks(int,int,int))); this, SLOT(_q_reformatBlocks(int,int,int)));
d->rehighlightPending = true; if (!d->doc->isEmpty()) {
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); d->rehighlightPending = true;
QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight()));
}
} }
} }

View File

@ -51,7 +51,9 @@
#include <qregularexpression.h> #include <qregularexpression.h>
#endif #endif
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qthread.h> #include <qthread.h>
#include <qcoreapplication.h> #include <qcoreapplication.h>
#include <qmetaobject.h> #include <qmetaobject.h>
@ -209,7 +211,7 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
This function is defined in the \c <QTextDocument> header file. This function is defined in the \c <QTextDocument> header file.
*/ */
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *Qt::codecForHtml(const QByteArray &ba) QTextCodec *Qt::codecForHtml(const QByteArray &ba)
{ {
return QTextCodec::codecForHtml(ba); return QTextCodec::codecForHtml(ba);

View File

@ -75,7 +75,7 @@ namespace Qt
Q_GUI_EXPORT bool mightBeRichText(const QString&); Q_GUI_EXPORT bool mightBeRichText(const QString&);
Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre); Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre);
#if !defined(QT_NO_TEXTCODEC) || defined(Q_CLANG_QDOC) #if QT_CONFIG(textcodec) || defined(Q_CLANG_QDOC)
Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba);
#endif #endif
} }

View File

@ -43,7 +43,6 @@
#include "qtextlist.h" #include "qtextlist.h"
#include <qdebug.h> #include <qdebug.h>
#include <qtextcodec.h>
#include <qbytearray.h> #include <qbytearray.h>
#include <qdatastream.h> #include <qdatastream.h>
#include <qdatetime.h> #include <qdatetime.h>

View File

@ -41,7 +41,9 @@
#include <QtCore/qfile.h> #include <QtCore/qfile.h>
#include <QtCore/qbytearray.h> #include <QtCore/qbytearray.h>
#include <QtCore/qfileinfo.h> #include <QtCore/qfileinfo.h>
#if QT_CONFIG(textcodec)
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#endif
#include <QtCore/qtextstream.h> #include <QtCore/qtextstream.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include "qtextdocument.h" #include "qtextdocument.h"
@ -63,7 +65,7 @@ public:
QByteArray format; QByteArray format;
QIODevice *device; QIODevice *device;
bool deleteDevice; bool deleteDevice;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *codec; QTextCodec *codec;
#endif #endif
@ -104,7 +106,7 @@ public:
QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq) QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq)
: device(0), : device(0),
deleteDevice(false), deleteDevice(false),
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
codec(QTextCodec::codecForName("utf-8")), codec(QTextCodec::codecForName("utf-8")),
#endif #endif
q(qq) q(qq)
@ -258,7 +260,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
#ifndef QT_NO_TEXTODFWRITER #ifndef QT_NO_TEXTODFWRITER
if (format == "odf" || format == "opendocumentformat" || format == "odt") { if (format == "odf" || format == "opendocumentformat" || format == "odt") {
QTextOdfWriter writer(*document, d->device); QTextOdfWriter writer(*document, d->device);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
writer.setCodec(d->codec); writer.setCodec(d->codec);
#endif #endif
return writer.writeAll(); return writer.writeAll();
@ -272,7 +274,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
return false; return false;
} }
QTextStream ts(d->device); QTextStream ts(d->device);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
ts.setCodec(d->codec); ts.setCodec(d->codec);
ts << document->toHtml(d->codec->name()); ts << document->toHtml(d->codec->name());
#endif #endif
@ -286,7 +288,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document)
return false; return false;
} }
QTextStream ts(d->device); QTextStream ts(d->device);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
ts.setCodec(d->codec); ts.setCodec(d->codec);
#endif #endif
ts << document->toPlainText(); ts << document->toPlainText();
@ -317,7 +319,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment)
uses UTF-8. uses UTF-8.
*/ */
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void QTextDocumentWriter::setCodec(QTextCodec *codec) void QTextDocumentWriter::setCodec(QTextCodec *codec)
{ {
if (codec == 0) if (codec == 0)
@ -330,7 +332,7 @@ void QTextDocumentWriter::setCodec(QTextCodec *codec)
/*! /*!
Returns the codec that is currently assigned to the writer. Returns the codec that is currently assigned to the writer.
*/ */
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *QTextDocumentWriter::codec() const QTextCodec *QTextDocumentWriter::codec() const
{ {
return d->codec; return d->codec;

View File

@ -70,7 +70,7 @@ public:
bool write(const QTextDocument *document); bool write(const QTextDocument *document);
bool write(const QTextDocumentFragment &fragment); bool write(const QTextDocumentFragment &fragment);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
void setCodec(QTextCodec *codec); void setCodec(QTextCodec *codec);
QTextCodec *codec() const; QTextCodec *codec() const;
#endif #endif

View File

@ -40,7 +40,6 @@
#include "qtexthtmlparser_p.h" #include "qtexthtmlparser_p.h"
#include <qbytearray.h> #include <qbytearray.h>
#include <qtextcodec.h>
#include <qstack.h> #include <qstack.h>
#include <qdebug.h> #include <qdebug.h>
#include <qthread.h> #include <qthread.h>

View File

@ -961,7 +961,7 @@ bool QTextOdfWriter::writeAll()
return false; return false;
} }
QXmlStreamWriter writer(m_strategy->contentStream); QXmlStreamWriter writer(m_strategy->contentStream);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (m_codec) if (m_codec)
writer.setCodec(m_codec); writer.setCodec(m_codec);
#endif #endif

View File

@ -418,8 +418,10 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q
QVariant ret; QVariant ret;
if (flavor == QLatin1String("public.utf8-plain-text")) { if (flavor == QLatin1String("public.utf8-plain-text")) {
ret = QString::fromUtf8(firstData); ret = QString::fromUtf8(firstData);
#if QT_CONFIG(textcodec)
} else if (flavor == QLatin1String("public.utf16-plain-text")) { } else if (flavor == QLatin1String("public.utf16-plain-text")) {
ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData); ret = QTextCodec::codecForName("UTF-16")->toUnicode(firstData);
#endif
} else { } else {
qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
} }
@ -432,8 +434,10 @@ QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &
QString string = data.toString(); QString string = data.toString();
if (flavor == QLatin1String("public.utf8-plain-text")) if (flavor == QLatin1String("public.utf8-plain-text"))
ret.append(string.toUtf8()); ret.append(string.toUtf8());
#if QT_CONFIG(textcodec)
else if (flavor == QLatin1String("public.utf16-plain-text")) else if (flavor == QLatin1String("public.utf16-plain-text"))
ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string)); ret.append(QTextCodec::codecForName("UTF-16")->fromUnicode(string));
#endif
return ret; return ret;
} }

View File

@ -269,11 +269,11 @@ int QLibInputKeyboard::keysymToQtKey(xkb_keysym_t key) const
int QLibInputKeyboard::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers *modifiers, const QString &text) const int QLibInputKeyboard::keysymToQtKey(xkb_keysym_t keysym, Qt::KeyboardModifiers *modifiers, const QString &text) const
{ {
int code = 0; int code = 0;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextCodec *systemCodec = QTextCodec::codecForLocale(); QTextCodec *systemCodec = QTextCodec::codecForLocale();
#endif #endif
if (keysym < 128 || (keysym < 256 if (keysym < 128 || (keysym < 256
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
&& systemCodec->mibEnum() == 4 && systemCodec->mibEnum() == 4
#endif #endif
)) { )) {

View File

@ -213,7 +213,7 @@ void QGIFFormat::disposePrevious(QImage *image)
case RestoreImage: { case RestoreImage: {
if (frame >= 0) { if (frame >= 0) {
for (int ln=t; ln<=b; ln++) { for (int ln=t; ln<=b; ln++) {
memcpy(image->scanLine(ln)+l, memcpy(image->scanLine(ln)+l*sizeof(QRgb),
backingstore.constScanLine(ln-t), backingstore.constScanLine(ln-t),
(r-l+1)*sizeof(QRgb)); (r-l+1)*sizeof(QRgb));
} }
@ -426,7 +426,7 @@ int QGIFFormat::decode(QImage *image, const uchar *buffer, int length,
unsigned char *dest_data = backingstore.bits(); unsigned char *dest_data = backingstore.bits();
for (int ln=0; ln<h; ln++) { for (int ln=0; ln<h; ln++) {
memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln), memcpy(FAST_SCAN_LINE(dest_data, dest_bpl, ln),
FAST_SCAN_LINE(bits, bpl, t+ln) + l, w*sizeof(QRgb)); FAST_SCAN_LINE(bits, bpl, t+ln) + l*sizeof(QRgb), w*sizeof(QRgb));
} }
} }

View File

@ -55,7 +55,6 @@
#include <qbuffer.h> #include <qbuffer.h>
#include <qdebug.h> #include <qdebug.h>
#include <qstringlist.h> #include <qstringlist.h>
#include <qtextcodec.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <stdlib.h> #include <stdlib.h>
#include <qabstracteventdispatcher.h> #include <qabstracteventdispatcher.h>

View File

@ -47,7 +47,6 @@
#include <private/qpaintengine_raster_p.h> #include <private/qpaintengine_raster_p.h>
#include <qprinter.h> #include <qprinter.h>
#include <qstack.h> #include <qstack.h>
#include <qtextcodec.h>
#include <qwidget.h> #include <qwidget.h>
#include <qvarlengtharray.h> #include <qvarlengtharray.h>
#include <qdebug.h> #include <qdebug.h>

View File

@ -312,7 +312,7 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co
case AllGLFunctionsQueryable: case AllGLFunctionsQueryable:
return true; return true;
case SwitchableWidgetComposition: case SwitchableWidgetComposition:
return true; return false; // QTBUG-68329 QTBUG-53515 QTBUG-54734
default: default:
return QPlatformIntegration::hasCapability(cap); return QPlatformIntegration::hasCapability(cap);
} }

View File

@ -168,7 +168,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
if (!encoding.isEmpty() if (!encoding.isEmpty()
&& atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) { && atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if (requestedType == QVariant::String) { if (requestedType == QVariant::String) {
QTextCodec *codec = QTextCodec::codecForName(encoding); QTextCodec *codec = QTextCodec::codecForName(encoding);
if (codec) if (codec)

View File

@ -48,7 +48,9 @@
#include <qsqlquery.h> #include <qsqlquery.h>
#include <qsqlrecord.h> #include <qsqlrecord.h>
#include <qstringlist.h> #include <qstringlist.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qvector.h> #include <qvector.h>
#include <qfile.h> #include <qfile.h>
#include <qdebug.h> #include <qdebug.h>
@ -86,7 +88,7 @@ class QMYSQLDriverPrivate : public QSqlDriverPrivate
public: public:
QMYSQLDriverPrivate() : QSqlDriverPrivate(), mysql(0), QMYSQLDriverPrivate() : QSqlDriverPrivate(), mysql(0),
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
tc(QTextCodec::codecForLocale()), tc(QTextCodec::codecForLocale()),
#else #else
tc(0), tc(0),
@ -100,7 +102,7 @@ public:
static inline QString toUnicode(QTextCodec *tc, const char *str) static inline QString toUnicode(QTextCodec *tc, const char *str)
{ {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(tc); Q_UNUSED(tc);
return QString::fromLatin1(str); return QString::fromLatin1(str);
#else #else
@ -110,7 +112,7 @@ static inline QString toUnicode(QTextCodec *tc, const char *str)
static inline QString toUnicode(QTextCodec *tc, const char *str, int length) static inline QString toUnicode(QTextCodec *tc, const char *str, int length)
{ {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(tc); Q_UNUSED(tc);
return QString::fromLatin1(str, length); return QString::fromLatin1(str, length);
#else #else
@ -120,7 +122,7 @@ static inline QString toUnicode(QTextCodec *tc, const char *str, int length)
static inline QByteArray fromUnicode(QTextCodec *tc, const QString &str) static inline QByteArray fromUnicode(QTextCodec *tc, const QString &str)
{ {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(tc); Q_UNUSED(tc);
return str.toLatin1(); return str.toLatin1();
#else #else
@ -255,7 +257,7 @@ public:
bool preparedQuery; bool preparedQuery;
}; };
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
static QTextCodec* codec(MYSQL* mysql) static QTextCodec* codec(MYSQL* mysql)
{ {
#if MYSQL_VERSION_ID >= 32321 #if MYSQL_VERSION_ID >= 32321
@ -265,7 +267,7 @@ static QTextCodec* codec(MYSQL* mysql)
#endif #endif
return QTextCodec::codecForLocale(); return QTextCodec::codecForLocale();
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, static QSqlError qMakeError(const QString& err, QSqlError::ErrorType type,
const QMYSQLDriverPrivate* p) const QMYSQLDriverPrivate* p)
@ -1205,7 +1207,7 @@ QMYSQLDriver::QMYSQLDriver(MYSQL * con, QObject * parent)
init(); init();
if (con) { if (con) {
d->mysql = (MYSQL *) con; d->mysql = (MYSQL *) con;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
d->tc = codec(con); d->tc = codec(con);
#endif #endif
setOpen(true); setOpen(true);
@ -1434,14 +1436,14 @@ bool QMYSQLDriver::open(const QString& db,
if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) { if (mysql_get_client_version() >= 50503 && mysql_get_server_version(d->mysql) >= 50503) {
// force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters) // force the communication to be utf8mb4 (only utf8mb4 supports 4-byte characters)
mysql_set_character_set(d->mysql, "utf8mb4"); mysql_set_character_set(d->mysql, "utf8mb4");
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
d->tc = QTextCodec::codecForName("UTF-8"); d->tc = QTextCodec::codecForName("UTF-8");
#endif #endif
} else } else
{ {
// force the communication to be utf8 // force the communication to be utf8
mysql_set_character_set(d->mysql, "utf8"); mysql_set_character_set(d->mysql, "utf8");
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
d->tc = codec(d->mysql); d->tc = codec(d->mysql);
#endif #endif
} }

View File

@ -138,7 +138,7 @@ int runUic(int argc, char *argv[])
return 1; return 1;
} }
out = new QTextStream(&f); out = new QTextStream(&f);
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
out->setCodec(QTextCodec::codecForName("UTF-8")); out->setCodec(QTextCodec::codecForName("UTF-8"));
#endif #endif
} }

View File

@ -58,7 +58,6 @@
#include "qstyle.h" #include "qstyle.h"
#include "qstyleoption.h" #include "qstyleoption.h"
#include "qstylefactory.h" #include "qstylefactory.h"
#include "qtextcodec.h"
#include "qtooltip.h" #include "qtooltip.h"
#include "qtranslator.h" #include "qtranslator.h"
#include "qvariant.h" #include "qvariant.h"

View File

@ -63,7 +63,9 @@
#include <qregexp.h> #include <qregexp.h>
#include <qstring.h> #include <qstring.h>
#include <qstringlist.h> #include <qstringlist.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qapplication.h> #include <qapplication.h>
#include <qbitmap.h> #include <qbitmap.h>

View File

@ -1053,20 +1053,8 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
static bool switchableWidgetComposition = static bool switchableWidgetComposition =
QGuiApplicationPrivate::instance()->platformIntegration() QGuiApplicationPrivate::instance()->platformIntegration()
->hasCapability(QPlatformIntegration::SwitchableWidgetComposition); ->hasCapability(QPlatformIntegration::SwitchableWidgetComposition);
if (!switchableWidgetComposition if (!switchableWidgetComposition)
// The Windows compositor handles fullscreen OpenGL window specially. Besides
// having trouble with popups, it also has issues with flip-flopping between
// OpenGL-based and normal flushing. Therefore, stick with GL for fullscreen
// windows (QTBUG-53515). Similary, translucent windows should not switch to
// layered native windows (QTBUG-54734).
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE)
|| tlw->windowState().testFlag(Qt::WindowFullScreen)
|| tlw->testAttribute(Qt::WA_TranslucentBackground)
#endif
)
{
return qt_dummy_platformTextureList(); return qt_dummy_platformTextureList();
}
} }
return 0; return 0;

View File

@ -47,7 +47,9 @@
#include <qdebug.h> #include <qdebug.h>
#include <qabstracttextdocumentlayout.h> #include <qabstracttextdocumentlayout.h>
#include "private/qtextdocumentlayout_p.h" #include "private/qtextdocumentlayout_p.h"
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qpainter.h> #include <qpainter.h>
#include <qdir.h> #include <qdir.h>
#if QT_CONFIG(whatsthis) #if QT_CONFIG(whatsthis)
@ -293,7 +295,7 @@ void QTextBrowserPrivate::setSource(const QUrl &url)
if (data.type() == QVariant::String) { if (data.type() == QVariant::String) {
txt = data.toString(); txt = data.toString();
} else if (data.type() == QVariant::ByteArray) { } else if (data.type() == QVariant::ByteArray) {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QByteArray ba = data.toByteArray(); QByteArray ba = data.toByteArray();
QTextCodec *codec = Qt::codecForHtml(ba); QTextCodec *codec = Qt::codecForHtml(ba);
txt = codec->toUnicode(ba); txt = codec->toUnicode(ba);

View File

@ -49,7 +49,9 @@
#include <qiodevice.h> #include <qiodevice.h>
#include <qlist.h> #include <qlist.h>
#include <qregexp.h> #include <qregexp.h>
#if QT_CONFIG(textcodec)
#include <qtextcodec.h> #include <qtextcodec.h>
#endif
#include <qtextstream.h> #include <qtextstream.h>
#include <qxml.h> #include <qxml.h>
#include "private/qxml_p.h" #include "private/qxml_p.h"
@ -4149,7 +4151,7 @@ static QString encodeText(const QString &str,
const bool performAVN = false, const bool performAVN = false,
const bool encodeEOLs = false) const bool encodeEOLs = false)
{ {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(s); Q_UNUSED(s);
#else #else
const QTextCodec *const codec = s.codec(); const QTextCodec *const codec = s.codec();
@ -4191,7 +4193,7 @@ static QString encodeText(const QString &str,
len += 4; len += 4;
i += 5; i += 5;
} else { } else {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
if(codec->canEncode(ati)) if(codec->canEncode(ati))
++i; ++i;
else else
@ -6428,7 +6430,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
const QDomNodePrivate* n = first; const QDomNodePrivate* n = first;
if(encUsed == QDomNode::EncodingFromDocument) { if(encUsed == QDomNode::EncodingFromDocument) {
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
const QDomNodePrivate* n = first; const QDomNodePrivate* n = first;
QTextCodec *codec = 0; QTextCodec *codec = 0;
@ -6464,7 +6466,7 @@ void QDomDocumentPrivate::saveDocument(QTextStream& s, const int indent, QDomNod
else { else {
// Write out the XML declaration. // Write out the XML declaration.
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
const QLatin1String codecName("iso-8859-1"); const QLatin1String codecName("iso-8859-1");
#else #else
const QTextCodec *const codec = s.codec(); const QTextCodec *const codec = s.codec();

View File

@ -39,7 +39,9 @@
#include "qxml.h" #include "qxml.h"
#include "qxml_p.h" #include "qxml_p.h"
#if QT_CONFIG(textcodec)
#include "qtextcodec.h" #include "qtextcodec.h"
#endif
#include "qbuffer.h" #include "qbuffer.h"
#include "qregexp.h" #include "qregexp.h"
#include "qmap.h" #include "qmap.h"
@ -237,7 +239,7 @@ public:
int pos; int pos;
int length; int length;
bool nextReturnedEndOfData; bool nextReturnedEndOfData;
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
QTextDecoder *encMapper; QTextDecoder *encMapper;
#endif #endif
@ -1075,7 +1077,7 @@ void QXmlInputSource::init()
d->inputStream = 0; d->inputStream = 0;
setData(QString()); setData(QString());
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
d->encMapper = 0; d->encMapper = 0;
#endif #endif
d->nextReturnedEndOfData = true; // first call to next() will call fetchData() d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
@ -1121,7 +1123,7 @@ QXmlInputSource::QXmlInputSource(QIODevice *dev)
QXmlInputSource::~QXmlInputSource() QXmlInputSource::~QXmlInputSource()
{ {
// ### close the input device. // ### close the input device.
#ifndef QT_NO_TEXTCODEC #if QT_CONFIG(textcodec)
delete d->encMapper; delete d->encMapper;
#endif #endif
delete d; 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) static QString extractEncodingDecl(const QString &text, bool *needMoreText)
{ {
*needMoreText = false; *needMoreText = false;
@ -1326,7 +1328,7 @@ static QString extractEncodingDecl(const QString &text, bool *needMoreText)
return encoding; return encoding;
} }
#endif // QT_NO_TEXTCODEC #endif // textcodec
/*! /*!
This function reads the XML file from \a data and tries to 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) QString QXmlInputSource::fromRawData(const QByteArray &data, bool beginning)
{ {
#ifdef QT_NO_TEXTCODEC #if !QT_CONFIG(textcodec)
Q_UNUSED(beginning); Q_UNUSED(beginning);
return QString::fromLatin1(data.constData(), data.size()); return QString::fromLatin1(data.constData(), data.size());
#else #else

View File

@ -74,6 +74,7 @@ private slots:
void emptyBlocks(); void emptyBlocks();
void setCharFormat(); void setCharFormat();
void highlightOnInit(); void highlightOnInit();
void highlightOnInitAndAppend();
void stopHighlightingWhenStateDoesNotChange(); void stopHighlightingWhenStateDoesNotChange();
void unindent(); void unindent();
void highlightToEndOfDocument(); void highlightToEndOfDocument();
@ -265,6 +266,19 @@ void tst_QSyntaxHighlighter::highlightOnInit()
QTRY_VERIFY(hl->highlighted); QTRY_VERIFY(hl->highlighted);
} }
void tst_QSyntaxHighlighter::highlightOnInitAndAppend()
{
cursor.insertText("Hello");
cursor.insertBlock();
cursor.insertText("World");
TestHighlighter *hl = new TestHighlighter(doc);
cursor.insertBlock();
cursor.insertText("More text");
QTRY_VERIFY(hl->highlighted);
QVERIFY(hl->highlightedText.endsWith(doc->toPlainText().remove(QLatin1Char('\n'))));
}
class StateTestHighlighter : public QSyntaxHighlighter class StateTestHighlighter : public QSyntaxHighlighter
{ {
public: public:
@ -330,6 +344,7 @@ void tst_QSyntaxHighlighter::unindent()
QCOMPARE(doc->toPlainText(), plainText); QCOMPARE(doc->toPlainText(), plainText);
TestHighlighter *hl = new TestHighlighter(doc); TestHighlighter *hl = new TestHighlighter(doc);
QTRY_VERIFY(hl->highlighted);
hl->callCount = 0; hl->callCount = 0;
cursor.movePosition(QTextCursor::Start); cursor.movePosition(QTextCursor::Start);