summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/codecs')
-rw-r--r--src/corelib/codecs/codecs.pri89
-rw-r--r--src/corelib/codecs/codecs.qdoc6
-rw-r--r--src/corelib/codecs/qbig5codec.cpp2
-rw-r--r--src/corelib/codecs/qbig5codec_p.h26
-rw-r--r--src/corelib/codecs/qeucjpcodec.cpp3
-rw-r--r--src/corelib/codecs/qeucjpcodec_p.h6
-rw-r--r--src/corelib/codecs/qeuckrcodec.cpp3
-rw-r--r--src/corelib/codecs/qeuckrcodec_p.h6
-rw-r--r--src/corelib/codecs/qgb18030codec.cpp4
-rw-r--r--src/corelib/codecs/qgb18030codec_p.h6
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp2
-rw-r--r--src/corelib/codecs/qicucodec.cpp6
-rw-r--r--src/corelib/codecs/qicucodec_p.h6
-rw-r--r--src/corelib/codecs/qisciicodec.cpp4
-rw-r--r--src/corelib/codecs/qisciicodec_p.h6
-rw-r--r--src/corelib/codecs/qjiscodec.cpp3
-rw-r--r--src/corelib/codecs/qjiscodec_p.h6
-rw-r--r--src/corelib/codecs/qjpunicode.cpp4
-rw-r--r--src/corelib/codecs/qjpunicode_p.h6
-rw-r--r--src/corelib/codecs/qlatincodec.cpp4
-rw-r--r--src/corelib/codecs/qlatincodec_p.h6
-rw-r--r--src/corelib/codecs/qsimplecodec.cpp4
-rw-r--r--src/corelib/codecs/qsimplecodec_p.h6
-rw-r--r--src/corelib/codecs/qsjiscodec.cpp2
-rw-r--r--src/corelib/codecs/qsjiscodec_p.h6
-rw-r--r--src/corelib/codecs/qt_attribution.json7
-rw-r--r--src/corelib/codecs/qtextcodec.cpp98
-rw-r--r--src/corelib/codecs/qtextcodec.h7
-rw-r--r--src/corelib/codecs/qtextcodec_p.h11
-rw-r--r--src/corelib/codecs/qtsciicodec.cpp4
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h6
-rw-r--r--src/corelib/codecs/qutfcodec.cpp15
-rw-r--r--src/corelib/codecs/qutfcodec_p.h12
-rw-r--r--src/corelib/codecs/qwindowscodec.cpp8
-rw-r--r--src/corelib/codecs/qwindowscodec_p.h2
35 files changed, 188 insertions, 204 deletions
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index dc8974d13f..5d500ce521 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -1,54 +1,67 @@
# Qt core library codecs module
HEADERS += \
- codecs/qisciicodec_p.h \
- codecs/qlatincodec_p.h \
- codecs/qsimplecodec_p.h \
codecs/qtextcodec_p.h \
- codecs/qtextcodec.h \
- codecs/qtsciicodec_p.h \
codecs/qutfcodec_p.h
SOURCES += \
- codecs/qisciicodec.cpp \
- codecs/qlatincodec.cpp \
- codecs/qsimplecodec.cpp \
- codecs/qtextcodec.cpp \
- codecs/qtsciicodec.cpp \
codecs/qutfcodec.cpp
-qtConfig(icu) {
+qtConfig(textcodec) {
HEADERS += \
- codecs/qicucodec_p.h
- SOURCES += \
- codecs/qicucodec.cpp
-} else {
- 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
+ codecs/qlatincodec_p.h \
+ codecs/qsimplecodec_p.h \
+ codecs/qtextcodec.h
SOURCES += \
- codecs/qgb18030codec.cpp \
- 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
+ codecs/qlatincodec.cpp \
+ codecs/qsimplecodec.cpp \
+ codecs/qtextcodec.cpp
+
+ qtConfig(codecs) {
+ HEADERS += \
+ codecs/qisciicodec_p.h \
+ codecs/qtsciicodec_p.h
+
+ SOURCES += \
+ codecs/qisciicodec.cpp \
+ codecs/qtsciicodec.cpp
}
- win32 {
- SOURCES += codecs/qwindowscodec.cpp
- HEADERS += codecs/qwindowscodec_p.h
+ qtConfig(icu) {
+ HEADERS += \
+ codecs/qicucodec_p.h
+ SOURCES += \
+ 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
+
+ SOURCES += \
+ codecs/qgb18030codec.cpp \
+ 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
+ QMAKE_USE_PRIVATE += iconv
+ }
+
+ win32 {
+ SOURCES += codecs/qwindowscodec.cpp
+ HEADERS += codecs/qwindowscodec_p.h
+ }
}
}
diff --git a/src/corelib/codecs/codecs.qdoc b/src/corelib/codecs/codecs.qdoc
index 9364b7a989..ec9b8185e2 100644
--- a/src/corelib/codecs/codecs.qdoc
+++ b/src/corelib/codecs/codecs.qdoc
@@ -276,13 +276,11 @@
TSCII, formally the Tamil Standard Code Information Interchange
specification, is a commonly used charset for Tamils. The
- official page for the standard is at
- \l{http://www.tamil.net/tscii/}
+ official page for the standard is \l{Information Technology in Tamil}
- This codec uses the mapping table found at
- \l{http://www.geocities.com/Athens/5180/tsciiset.html}.
Tamil uses composed Unicode which might cause some
problems if you are using Unicode fonts instead of TSCII fonts.
+ A Tamil codepage layout can be found on \l {Tamil Script Code}.
Most of the code was written by Hans Petter Bieker and is
included in Qt with the author's permission and the grateful
diff --git a/src/corelib/codecs/qbig5codec.cpp b/src/corelib/codecs/qbig5codec.cpp
index bfd07408b8..381bf3f790 100644
--- a/src/corelib/codecs/qbig5codec.cpp
+++ b/src/corelib/codecs/qbig5codec.cpp
@@ -41,7 +41,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
static int qt_Big5hkscsToUnicode(const uchar *s, uint *pwc);
static int qt_UnicodeToBig5hkscs(uint wc, uchar *r);
@@ -12661,6 +12660,5 @@ int qt_UnicodeToBig5hkscs (uint wc, uchar *r)
/* ====================================================================== */
-#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qbig5codec_p.h b/src/corelib/codecs/qbig5codec_p.h
index 9dbcf41a6d..c17afae1c4 100644
--- a/src/corelib/codecs/qbig5codec_p.h
+++ b/src/corelib/codecs/qbig5codec_p.h
@@ -59,9 +59,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QBig5Codec : public QTextCodec {
public:
@@ -69,12 +69,12 @@ public:
static QList<QByteArray> _aliases();
static int _mibEnum();
- QByteArray name() const { return _name(); }
- QList<QByteArray> aliases() const { return _aliases(); }
- int mibEnum() const { return _mibEnum(); }
+ QByteArray name() const override { return _name(); }
+ QList<QByteArray> aliases() const override { return _aliases(); }
+ int mibEnum() const override { return _mibEnum(); }
- QString convertToUnicode(const char *, int, ConverterState *) const;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
class QBig5hkscsCodec : public QTextCodec {
@@ -83,16 +83,14 @@ public:
static QList<QByteArray> _aliases() { return QList<QByteArray>(); }
static int _mibEnum();
- QByteArray name() const { return _name(); }
- QList<QByteArray> aliases() const { return _aliases(); }
- int mibEnum() const { return _mibEnum(); }
+ QByteArray name() const override { return _name(); }
+ QList<QByteArray> aliases() const override { return _aliases(); }
+ int mibEnum() const override { return _mibEnum(); }
- QString convertToUnicode(const char *, int, ConverterState *) const;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QBIG5CODEC_P_H
diff --git a/src/corelib/codecs/qeucjpcodec.cpp b/src/corelib/codecs/qeucjpcodec.cpp
index c3131fe601..3192f355d8 100644
--- a/src/corelib/codecs/qeucjpcodec.cpp
+++ b/src/corelib/codecs/qeucjpcodec.cpp
@@ -76,8 +76,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
-
static const uchar Ss2 = 0x8e; // Single Shift 2
static const uchar Ss3 = 0x8f; // Single Shift 3
@@ -255,6 +253,5 @@ QByteArray QEucJpCodec::_name()
{
return "EUC-JP";
}
-#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qeucjpcodec_p.h b/src/corelib/codecs/qeucjpcodec_p.h
index f2a9f923c8..d79e2435e3 100644
--- a/src/corelib/codecs/qeucjpcodec_p.h
+++ b/src/corelib/codecs/qeucjpcodec_p.h
@@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QEucJpCodec : public QTextCodec {
public:
@@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QEUCJPCODEC_P_H
diff --git a/src/corelib/codecs/qeuckrcodec.cpp b/src/corelib/codecs/qeuckrcodec.cpp
index ec5253c7f9..47657cc01f 100644
--- a/src/corelib/codecs/qeuckrcodec.cpp
+++ b/src/corelib/codecs/qeuckrcodec.cpp
@@ -72,7 +72,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
unsigned int qt_Ksc5601ToUnicode(unsigned int code);
unsigned int qt_UnicodeToKsc5601(unsigned int unicode);
@@ -3523,6 +3522,4 @@ QString QCP949Codec::convertToUnicode(const char* chars, int len, ConverterState
return result;
}
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qeuckrcodec_p.h b/src/corelib/codecs/qeuckrcodec_p.h
index bedf0cf822..6180548aab 100644
--- a/src/corelib/codecs/qeuckrcodec_p.h
+++ b/src/corelib/codecs/qeuckrcodec_p.h
@@ -80,9 +80,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QEucKrCodec : public QTextCodec {
public:
@@ -112,8 +112,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QEUCKRCODEC_P_H
diff --git a/src/corelib/codecs/qgb18030codec.cpp b/src/corelib/codecs/qgb18030codec.cpp
index 04e4bef4cd..4206eacb6f 100644
--- a/src/corelib/codecs/qgb18030codec.cpp
+++ b/src/corelib/codecs/qgb18030codec.cpp
@@ -45,8 +45,6 @@
#include "qgb18030codec_p.h"
-#ifndef QT_NO_BIG_CODECS
-
QT_BEGIN_NAMESPACE
#define InRange(c, lower, upper) (((c) >= (lower)) && ((c) <= (upper)))
@@ -9116,5 +9114,3 @@ int qt_UnicodeToGbk(uint uni, uchar *gbchar) {
}
QT_END_NAMESPACE
-
-#endif // QT_NO_BIG_CODECS
diff --git a/src/corelib/codecs/qgb18030codec_p.h b/src/corelib/codecs/qgb18030codec_p.h
index 635150b18e..c263309357 100644
--- a/src/corelib/codecs/qgb18030codec_p.h
+++ b/src/corelib/codecs/qgb18030codec_p.h
@@ -57,9 +57,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QGb18030Codec : public QTextCodec {
public:
@@ -108,8 +108,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QGB18030CODEC_P_H
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 330eb7c038..9c39727946 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -39,8 +39,6 @@
#include <QtCore/private/qglobal_p.h>
-QT_REQUIRE_CONFIG(iconv);
-
#include "qiconvcodec_p.h"
#include "qtextcodec_p.h"
#include <qdebug.h>
diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp
index ee9f1d0048..101c3a3278 100644
--- a/src/corelib/codecs/qicucodec.cpp
+++ b/src/corelib/codecs/qicucodec.cpp
@@ -39,8 +39,6 @@
#include "qicucodec_p.h"
-#ifndef QT_NO_TEXTCODEC
-
#include "qtextcodec_p.h"
#include "qutfcodec_p.h"
#include "qlatincodec_p.h"
@@ -373,7 +371,7 @@ static QTextCodec *loadQtCodec(const char *name)
return new QUtf32LECodec;
if (!strcmp(name, "ISO-8859-16") || !strcmp(name, "latin10") || !strcmp(name, "iso-ir-226"))
return new QSimpleTextCodec(13 /* == 8859-16*/);
-#ifndef QT_NO_CODECS
+#if QT_CONFIG(codecs)
if (!strcmp(name, "TSCII"))
return new QTsciiCodec;
if (!qstrnicmp(name, "iscii", 5))
@@ -698,5 +696,3 @@ int QIcuCodec::mibEnum() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qicucodec_p.h b/src/corelib/codecs/qicucodec_p.h
index 0c2dbe17d6..1cbe4d4e7a 100644
--- a/src/corelib/codecs/qicucodec_p.h
+++ b/src/corelib/codecs/qicucodec_p.h
@@ -59,9 +59,9 @@ extern "C" {
typedef struct UConverter UConverter;
}
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(textcodec);
-#ifndef QT_NO_TEXTCODEC
+QT_BEGIN_NAMESPACE
class QIcuCodec : public QTextCodec
{
@@ -90,8 +90,6 @@ private:
const char *m_name;
};
-#endif // QT_NO_TEXTCODEC
-
QT_END_NAMESPACE
#endif
diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp
index 499e8549a7..d9a86d77c7 100644
--- a/src/corelib/codecs/qisciicodec.cpp
+++ b/src/corelib/codecs/qisciicodec.cpp
@@ -40,8 +40,6 @@
#include "qtextcodec_p.h"
#include "qlist.h"
-#ifndef QT_NO_CODECS
-
QT_BEGIN_NAMESPACE
/*!
@@ -291,5 +289,3 @@ QString QIsciiCodec::convertToUnicode(const char* chars, int len, ConverterState
}
QT_END_NAMESPACE
-
-#endif // QT_NO_CODECS
diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h
index f818e7d83e..2c1b3ca9e0 100644
--- a/src/corelib/codecs/qisciicodec_p.h
+++ b/src/corelib/codecs/qisciicodec_p.h
@@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(codecs);
-#ifndef QT_NO_CODECS
+QT_BEGIN_NAMESPACE
class QIsciiCodec : public QTextCodec {
public:
@@ -75,8 +75,6 @@ private:
int idx;
};
-#endif // QT_NO_CODECS
-
QT_END_NAMESPACE
#endif // QISCIICODEC_P_H
diff --git a/src/corelib/codecs/qjiscodec.cpp b/src/corelib/codecs/qjiscodec.cpp
index a8625db054..77ec2adafd 100644
--- a/src/corelib/codecs/qjiscodec.cpp
+++ b/src/corelib/codecs/qjiscodec.cpp
@@ -52,7 +52,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
enum {
Esc = 0x1b,
So = 0x0e, // Shift Out
@@ -369,6 +368,4 @@ QList<QByteArray> QJisCodec::_aliases()
return list;
}
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qjiscodec_p.h b/src/corelib/codecs/qjiscodec_p.h
index 1ffe4a63f6..41195af108 100644
--- a/src/corelib/codecs/qjiscodec_p.h
+++ b/src/corelib/codecs/qjiscodec_p.h
@@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QJisCodec : public QTextCodec {
public:
@@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QJISCODEC_P_H
diff --git a/src/corelib/codecs/qjpunicode.cpp b/src/corelib/codecs/qjpunicode.cpp
index 23112ce4d3..61f6eac93a 100644
--- a/src/corelib/codecs/qjpunicode.cpp
+++ b/src/corelib/codecs/qjpunicode.cpp
@@ -50,8 +50,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
-
#define USE_JISX0212
#define Q_STRICT
@@ -10734,6 +10732,4 @@ uint QJpUnicodeConv::unicodeToCp932(uint h, uint l) const
\internal
*/
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qjpunicode_p.h b/src/corelib/codecs/qjpunicode_p.h
index 4fa2b9f757..9d1cdf3bf0 100644
--- a/src/corelib/codecs/qjpunicode_p.h
+++ b/src/corelib/codecs/qjpunicode_p.h
@@ -82,9 +82,9 @@
#include <QtCore/private/qglobal_p.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QJpUnicodeConv {
public:
@@ -180,8 +180,6 @@ private:
int rule;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QJPUNICODE_P_H
diff --git a/src/corelib/codecs/qlatincodec.cpp b/src/corelib/codecs/qlatincodec.cpp
index cfbd481f1e..1b53d26ef4 100644
--- a/src/corelib/codecs/qlatincodec.cpp
+++ b/src/corelib/codecs/qlatincodec.cpp
@@ -40,8 +40,6 @@
#include "qlatincodec_p.h"
#include "qlist.h"
-#ifndef QT_NO_TEXTCODEC
-
QT_BEGIN_NAMESPACE
QLatin1Codec::~QLatin1Codec()
@@ -238,5 +236,3 @@ int QLatin15Codec::mibEnum() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qlatincodec_p.h b/src/corelib/codecs/qlatincodec_p.h
index 3e258e5ae1..26f9e596a9 100644
--- a/src/corelib/codecs/qlatincodec_p.h
+++ b/src/corelib/codecs/qlatincodec_p.h
@@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(textcodec);
-#ifndef QT_NO_TEXTCODEC
+QT_BEGIN_NAMESPACE
class QLatin1Codec : public QTextCodec
{
@@ -86,8 +86,6 @@ public:
int mibEnum() const override;
};
-#endif // QT_NO_TEXTCODEC
-
QT_END_NAMESPACE
#endif // QLATINCODEC_P_H
diff --git a/src/corelib/codecs/qsimplecodec.cpp b/src/corelib/codecs/qsimplecodec.cpp
index beb0a08f62..9ab545d783 100644
--- a/src/corelib/codecs/qsimplecodec.cpp
+++ b/src/corelib/codecs/qsimplecodec.cpp
@@ -40,8 +40,6 @@
#include "qsimplecodec_p.h"
#include "qlist.h"
-#ifndef QT_NO_TEXTCODEC
-
QT_BEGIN_NAMESPACE
#define LAST_MIB 2004
@@ -724,5 +722,3 @@ int QSimpleTextCodec::mibEnum() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qsimplecodec_p.h b/src/corelib/codecs/qsimplecodec_p.h
index 188c3f3cb4..a4b2a45e6b 100644
--- a/src/corelib/codecs/qsimplecodec_p.h
+++ b/src/corelib/codecs/qsimplecodec_p.h
@@ -54,9 +54,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(textcodec);
-#ifndef QT_NO_TEXTCODEC
+QT_BEGIN_NAMESPACE
template <typename T> class QAtomicPointer;
@@ -79,8 +79,6 @@ private:
mutable QAtomicPointer<QByteArray> reverseMap;
};
-#endif // QT_NO_TEXTCODEC
-
QT_END_NAMESPACE
#endif // QSIMPLECODEC_P_H
diff --git a/src/corelib/codecs/qsjiscodec.cpp b/src/corelib/codecs/qsjiscodec.cpp
index ba342c9c53..4f5f9069cd 100644
--- a/src/corelib/codecs/qsjiscodec.cpp
+++ b/src/corelib/codecs/qsjiscodec.cpp
@@ -52,7 +52,6 @@
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_BIG_CODECS
enum {
Esc = 0x1b
};
@@ -223,6 +222,5 @@ QList<QByteArray> QSjisCodec::_aliases()
<< "MS_Kanji";
return list;
}
-#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qsjiscodec_p.h b/src/corelib/codecs/qsjiscodec_p.h
index 6257a7875c..1e5cd44f26 100644
--- a/src/corelib/codecs/qsjiscodec_p.h
+++ b/src/corelib/codecs/qsjiscodec_p.h
@@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(big_codecs);
-#ifndef QT_NO_BIG_CODECS
+QT_BEGIN_NAMESPACE
class QSjisCodec : public QTextCodec {
public:
@@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv;
};
-#endif // QT_NO_BIG_CODECS
-
QT_END_NAMESPACE
#endif // QSJISCODEC_P_H
diff --git a/src/corelib/codecs/qt_attribution.json b/src/corelib/codecs/qt_attribution.json
index 41f644a030..0815074675 100644
--- a/src/corelib/codecs/qt_attribution.json
+++ b/src/corelib/codecs/qt_attribution.json
@@ -6,6 +6,7 @@
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qbig5codec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The Big5 codecs (QBig5Codec, QBig5hkscsCodec)
provide conversion to and from the Big5 encodings.",
"License": "BSD 2-clause \"Simplified\" License",
@@ -23,6 +24,7 @@ Copyright (C) 2001, 2002 Anthony Fok, ThizLinux Laboratory Ltd."
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qeucjpcodec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The EUC-JP text codec provides conversion to and from EUC-JP,
the main legacy encoding for Unix machines in Japan.",
"License": "BSD 2-clause \"Simplified\" License",
@@ -37,6 +39,7 @@ the main legacy encoding for Unix machines in Japan.",
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qeuckrcodec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The EUC-KR text codec provides conversion to and from EUC-KR, KR,
the main legacy encoding for Unix machines in Korea.",
"License": "BSD 2-clause \"Simplified\" License",
@@ -51,6 +54,7 @@ the main legacy encoding for Unix machines in Korea.",
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qjiscodec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The ISO 2022-JP (JIS) text codec provides conversion to and from ISO 2022-JP.",
"License": "BSD 2-clause \"Simplified\" License",
"LicenseId": "BSD-2-Clause",
@@ -64,6 +68,7 @@ the main legacy encoding for Unix machines in Korea.",
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qsjiscodec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The Shift-JIS text codec provides conversion to and from Shift-JIS.",
"License": "BSD 2-clause \"Simplified\" License",
"LicenseId": "BSD-2-Clause",
@@ -77,6 +82,7 @@ the main legacy encoding for Unix machines in Korea.",
"QtUsage": "Used in Qt Core.",
"Path": "qtsciicodec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The TSCII text codec provides conversion to and from the Tamil TSCII
encoding.",
"License": "BSD 2-clause \"Simplified\" License",
@@ -91,6 +97,7 @@ encoding.",
"QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.",
"Path": "qgb18030codec.cpp",
+ "Description": "Treat as final version; no upstream known",
"Description": "The GBK codec provides conversion to and from the Chinese
GB18030/GBK/GB2312 encoding.",
"License": "BSD 2-clause \"Simplified\" License",
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index adb84a1856..602b97e32e 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -39,14 +39,14 @@
****************************************************************************/
#include "qplatformdefs.h"
+
#include "qtextcodec.h"
#include "qtextcodec_p.h"
-#ifndef QT_NO_TEXTCODEC
-
#include "qbytearraymatcher.h"
-#include "qlist.h"
+#include "qendian.h"
#include "qfile.h"
+#include "qlist.h"
#include "qstringlist.h"
#include "qvarlengtharray.h"
#if !defined(QT_BOOTSTRAPPED)
@@ -58,8 +58,10 @@
#include "qlatincodec_p.h"
#if !defined(QT_BOOTSTRAPPED)
+#if QT_CONFIG(codecs)
# include "qtsciicodec_p.h"
# include "qisciicodec_p.h"
+#endif
#if QT_CONFIG(icu)
#include "qicucodec_p.h"
#else
@@ -70,7 +72,7 @@
# include "qwindowscodec_p.h"
#endif
# include "qsimplecodec_p.h"
-#if !defined(QT_NO_BIG_CODECS)
+#if QT_CONFIG(big_codecs)
# ifndef Q_OS_INTEGRITY
# include "qgb18030codec_p.h"
# include "qeucjpcodec_p.h"
@@ -79,7 +81,7 @@
# include "qeuckrcodec_p.h"
# include "qbig5codec_p.h"
# endif // !Q_OS_INTEGRITY
-#endif // !QT_NO_BIG_CODECS
+#endif // big_codecs
#endif // icu
#endif // QT_BOOTSTRAPPED
@@ -269,14 +271,14 @@ static void setup()
return;
initialized = true;
-#if !defined(QT_NO_CODECS) && !defined(QT_BOOTSTRAPPED)
+#if QT_CONFIG(codecs) && !defined(QT_BOOTSTRAPPED)
(void)new QTsciiCodec;
for (int i = 0; i < 9; ++i)
(void)new QIsciiCodec(i);
for (int i = 0; i < QSimpleTextCodec::numSimpleCodecs; ++i)
(void)new QSimpleTextCodec(i);
-# if !defined(QT_NO_BIG_CODECS) && !defined(Q_OS_INTEGRITY)
+# if QT_CONFIG(big_codecs) && !defined(Q_OS_INTEGRITY)
(void)new QGb18030Codec;
(void)new QGbkCodec;
(void)new QGb2312Codec;
@@ -287,14 +289,14 @@ static void setup()
(void)new QCP949Codec;
(void)new QBig5Codec;
(void)new QBig5hkscsCodec;
-# endif // !QT_NO_BIG_CODECS && !Q_OS_INTEGRITY
+# endif // big_codecs && !Q_OS_INTEGRITY
#if QT_CONFIG(iconv)
(void) new QIconvCodec;
#endif
#if defined(Q_OS_WIN32)
(void) new QWindowsLocalCodec;
#endif // Q_OS_WIN32
-#endif // !QT_NO_CODECS && !QT_BOOTSTRAPPED
+#endif // codecs && !QT_BOOTSTRAPPED
(void)new QUtf16Codec;
(void)new QUtf16BECodec;
@@ -503,9 +505,9 @@ QTextCodec::~QTextCodec()
globalData->allCodecs.removeOne(this);
- auto it = globalData->codecCache.cbegin();
+ auto it = globalData->codecCache.begin();
- while (it != globalData->codecCache.cend()) {
+ while (it != globalData->codecCache.end()) {
if (it.value() == this)
it = globalData->codecCache.erase(it);
else
@@ -693,11 +695,9 @@ void QTextCodec::setCodecForLocale(QTextCodec *c)
\threadsafe
Returns a pointer to the codec most suitable for this locale.
- On Windows, the codec will be based on a system locale. On Unix
- systems, the codec will might fall back to using the \e iconv
- library if no builtin codec for the locale can be found.
-
- Note that in these cases the codec's name will be "System".
+ The codec will be retrieved from ICU where that backend is in use, otherwise
+ it may be obtained from an OS-specific API. In the latter case, the codec's
+ name may be "System".
*/
QTextCodec* QTextCodec::codecForLocale()
@@ -764,7 +764,7 @@ QList<QByteArray> QTextCodec::aliases() const
encoding of the subclass to Unicode, and returns the result in a
QString.
- \a state can be 0, in which case the conversion is stateless and
+ \a state can be \nullptr, in which case the conversion is stateless and
default conversion rules should be used. If state is not 0, the
codec should save the state after the conversion in \a state, and
adjust the \c remainingChars and \c invalidChars members of the struct.
@@ -780,7 +780,7 @@ QList<QByteArray> QTextCodec::aliases() const
from Unicode to the encoding of the subclass, and returns the result
in a QByteArray.
- \a state can be 0 in which case the conversion is stateless and
+ \a state can be \nullptr in which case the conversion is stateless and
default conversion rules should be used. If state is not 0, the
codec should save the state after the conversion in \a state, and
adjust the \c remainingChars and \c invalidChars members of the struct.
@@ -1061,7 +1061,7 @@ QString QTextDecoder::toUnicode(const char *chars, int len)
}
// in qstring.cpp:
-void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW;
+void qt_from_latin1(ushort *dst, const char *str, size_t size) noexcept;
/*! \overload
@@ -1162,41 +1162,50 @@ QTextCodec *QTextCodec::codecForHtml(const QByteArray &ba)
Tries to detect the encoding of the provided snippet \a ba by
using the BOM (Byte Order Mark) and returns a QTextCodec instance
- that is capable of decoding the text to unicode. If the codec
- cannot be detected from the content provided, \a defaultCodec is
- returned.
+ that is capable of decoding the text to unicode. This function can
+ detect one of the following codecs:
+
+ \list
+ \li UTF-32 Little Endian
+ \li UTF-32 Big Endian
+ \li UTF-16 Little Endian
+ \li UTF-16 Big Endian
+ \li UTF-8
+ \endlist
+
+ If the codec cannot be detected from the content provided, \a defaultCodec
+ is returned.
\sa codecForHtml()
*/
QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaultCodec)
{
const int arraySize = ba.size();
+ const uchar *buf = reinterpret_cast<const uchar *>(ba.constData());
+ const uint bom = 0xfeff;
if (arraySize > 3) {
- if ((uchar)ba[0] == 0x00
- && (uchar)ba[1] == 0x00
- && (uchar)ba[2] == 0xFE
- && (uchar)ba[3] == 0xFF)
+ uint uc = qFromUnaligned<uint>(buf);
+ if (uc == qToBigEndian(bom))
return QTextCodec::codecForMib(1018); // utf-32 be
- else if ((uchar)ba[0] == 0xFF
- && (uchar)ba[1] == 0xFE
- && (uchar)ba[2] == 0x00
- && (uchar)ba[3] == 0x00)
+ else if (uc == qToLittleEndian(bom))
return QTextCodec::codecForMib(1019); // utf-32 le
}
if (arraySize < 2)
return defaultCodec;
- if ((uchar)ba[0] == 0xfe && (uchar)ba[1] == 0xff)
+
+ ushort uc = qFromUnaligned<ushort>(buf);
+ if (uc == qToBigEndian(ushort(bom)))
return QTextCodec::codecForMib(1013); // utf16 be
- else if ((uchar)ba[0] == 0xff && (uchar)ba[1] == 0xfe)
+ else if (uc == qToLittleEndian(ushort(bom)))
return QTextCodec::codecForMib(1014); // utf16 le
if (arraySize < 3)
return defaultCodec;
- if ((uchar)ba[0] == 0xef
- && (uchar)ba[1] == 0xbb
- && (uchar)ba[2] == 0xbf)
+
+ static const char utf8bom[] = "\xef\xbb\xbf";
+ if (memcmp(buf, utf8bom, sizeof(utf8bom) - 1) == 0)
return QTextCodec::codecForMib(106); // utf-8
return defaultCodec;
@@ -1207,8 +1216,19 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba, QTextCodec *defaul
Tries to detect the encoding of the provided snippet \a ba by
using the BOM (Byte Order Mark) and returns a QTextCodec instance
- that is capable of decoding the text to unicode. If the codec
- cannot be detected, this overload returns a Latin-1 QTextCodec.
+ that is capable of decoding the text to unicode. This function can
+ detect one of the following codecs:
+
+ \list
+ \li UTF-32 Little Endian
+ \li UTF-32 Big Endian
+ \li UTF-16 Little Endian
+ \li UTF-16 Big Endian
+ \li UTF-8
+ \endlist
+
+ If the codec cannot be detected from the content provided, this overload
+ returns a Latin-1 QTextCodec.
\sa codecForHtml()
*/
@@ -1222,7 +1242,7 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba)
\obsolete
Returns the codec used by QObject::tr() on its argument. If this
- function returns 0 (the default), tr() assumes Latin-1.
+ function returns \nullptr (the default), tr() assumes Latin-1.
*/
/*!
@@ -1251,5 +1271,3 @@ bool QTextDecoder::needsMoreData() const
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 09d21166d8..3010a2714e 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -43,10 +43,9 @@
#include <QtCore/qstring.h>
#include <QtCore/qlist.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(textcodec);
-#ifndef QT_NO_TEXTCODEC
+QT_BEGIN_NAMESPACE
class QTextCodec;
class QIODevice;
@@ -168,8 +167,6 @@ private:
QTextCodec::ConverterState state;
};
-#endif // QT_NO_TEXTCODEC
-
QT_END_NAMESPACE
#endif // QTEXTCODEC_H
diff --git a/src/corelib/codecs/qtextcodec_p.h b/src/corelib/codecs/qtextcodec_p.h
index be0cab93e6..7fcf6df984 100644
--- a/src/corelib/codecs/qtextcodec_p.h
+++ b/src/corelib/codecs/qtextcodec_p.h
@@ -52,12 +52,13 @@
//
#include <QtCore/private/qglobal_p.h>
-#include "qtextcodec.h"
#include <string.h>
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)
#define QT_LOCALE_IS_UTF8
@@ -82,7 +83,7 @@ struct QTextCodecUnalignedPointer
bool qTextCodecNameMatch(const char *a, const char *b);
-#else
+#else // without textcodec:
class QTextCodec
{
@@ -97,7 +98,7 @@ public:
struct ConverterState {
ConverterState(ConversionFlags f = DefaultConversion)
- : flags(f), remainingChars(0), invalidChars(0), d(0) { state_data[0] = state_data[1] = state_data[2] = 0; }
+ : flags(f), remainingChars(0), invalidChars(0), d(nullptr) { state_data[0] = state_data[1] = state_data[2] = 0; }
~ConverterState() { }
ConversionFlags flags;
int remainingChars;
@@ -109,7 +110,7 @@ public:
};
};
-#endif //QT_NO_TEXTCODEC
+#endif // textcodec
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qtsciicodec.cpp b/src/corelib/codecs/qtsciicodec.cpp
index 49f38d1789..936fc4206d 100644
--- a/src/corelib/codecs/qtsciicodec.cpp
+++ b/src/corelib/codecs/qtsciicodec.cpp
@@ -44,8 +44,6 @@
#include "qtsciicodec_p.h"
#include "qlist.h"
-#ifndef QT_NO_CODECS
-
QT_BEGIN_NAMESPACE
static unsigned char qt_UnicodeToTSCII(ushort u1, ushort u2, ushort u3);
@@ -493,5 +491,3 @@ static unsigned int qt_TSCIIToUnicode(uint code, uint *s)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_CODECS
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index 78f9350a19..9247098e36 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -83,9 +83,9 @@
#include <QtCore/private/qglobal_p.h>
#include "QtCore/qtextcodec.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(codecs);
-#ifndef QT_NO_CODECS
+QT_BEGIN_NAMESPACE
class QTsciiCodec : public QTextCodec {
public:
@@ -98,8 +98,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
-#endif // QT_NO_CODECS
-
QT_END_NAMESPACE
#endif // QTSCIICODEC_P_H
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 26c68cdee5..85736fdf02 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -54,7 +54,7 @@ static const uchar utf8bom[] = { 0xef, 0xbb, 0xbf };
#if (defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)) \
|| (defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64))
-static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) Q_DECL_NOTHROW
+static Q_ALWAYS_INLINE uint qBitScanReverse(unsigned v) noexcept
{
uint result = qCountLeadingZeroBits(v);
// Now Invert the result: clz will count *down* from the msb to the lsb, so the msb index is 31
@@ -70,9 +70,14 @@ static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const
{
// do sixteen characters at a time
for ( ; end - src >= 16; src += 16, dst += 16) {
+# ifdef __AVX2__
+ __m256i data = _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src));
+ __m128i data1 = _mm256_castsi256_si128(data);
+ __m128i data2 = _mm256_extracti128_si256(data, 1);
+# else
__m128i data1 = _mm_loadu_si128((const __m128i*)src);
__m128i data2 = _mm_loadu_si128(1+(const __m128i*)src);
-
+# endif
// check if everything is ASCII
// the highest ASCII value is U+007F
@@ -499,7 +504,7 @@ QString QUtf8::convertToUnicode(const char *chars, int len)
This function never throws.
*/
-QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) Q_DECL_NOTHROW
+QChar *QUtf8::convertToUnicode(QChar *buffer, const char *chars, int len) noexcept
{
ushort *dst = reinterpret_cast<ushort *>(buffer);
const uchar *src = reinterpret_cast<const uchar *>(chars);
@@ -967,7 +972,7 @@ QString QUtf32::convertToUnicode(const char *chars, int len, QTextCodec::Convert
}
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
QUtf8Codec::~QUtf8Codec()
{
@@ -1121,6 +1126,6 @@ QList<QByteArray> QUtf32LECodec::aliases() const
return list;
}
-#endif //QT_NO_TEXTCODEC
+#endif // textcodec
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 7405996fba..083e16317a 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -52,7 +52,13 @@
// We mean it.
//
+#include <QtCore/qstring.h>
+#include <QtCore/qlist.h>
+
+#if QT_CONFIG(textcodec)
#include "QtCore/qtextcodec.h"
+#endif
+
#include "private/qtextcodec_p.h"
QT_BEGIN_NAMESPACE
@@ -285,7 +291,7 @@ enum DataEndianness
struct QUtf8
{
- static QChar *convertToUnicode(QChar *, const char *, int) Q_DECL_NOTHROW;
+ static QChar *convertToUnicode(QChar *, const char *, int) noexcept;
static QString convertToUnicode(const char *, int);
static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *);
static QByteArray convertFromUnicode(const QChar *, int);
@@ -311,7 +317,7 @@ struct QUtf32
static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *, DataEndianness = DetectEndianness);
};
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
class QUtf8Codec : public QTextCodec {
public:
@@ -391,7 +397,7 @@ public:
};
-#endif // QT_NO_TEXTCODEC
+#endif // textcodec
QT_END_NAMESPACE
diff --git a/src/corelib/codecs/qwindowscodec.cpp b/src/corelib/codecs/qwindowscodec.cpp
index 813d3c8153..710935a65a 100644
--- a/src/corelib/codecs/qwindowscodec.cpp
+++ b/src/corelib/codecs/qwindowscodec.cpp
@@ -83,8 +83,12 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
prev, 2, wc.data(), wc.length());
if (len) {
- prepend = true;
sp.append(QChar(wc[0]));
+ if (mblen == 1) {
+ state->remainingChars = 0;
+ return sp;
+ }
+ prepend = true;
mb++;
mblen--;
wc[0] = 0;
@@ -179,7 +183,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le
#else
QString s;
size_t size = mbstowcs(NULL, mb, length);
- if (size < 0) {
+ if (size == size_t(-1)) {
Q_ASSERT("Error in CE TextCodec");
return QString();
}
diff --git a/src/corelib/codecs/qwindowscodec_p.h b/src/corelib/codecs/qwindowscodec_p.h
index 1a74d618be..5bcab0ce66 100644
--- a/src/corelib/codecs/qwindowscodec_p.h
+++ b/src/corelib/codecs/qwindowscodec_p.h
@@ -53,6 +53,8 @@
#include <QtCore/private/qglobal_p.h>
#include "qtextcodec.h"
+QT_REQUIRE_CONFIG(textcodec);
+
QT_BEGIN_NAMESPACE
class QWindowsLocalCodec: public QTextCodec