Modernize the "big_codecs" feature

Change-Id: Ic23f4a1f81a21711cd81aaa2942b493aca5b38b8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Liang Qi 2018-09-13 12:45:20 +02:00
parent c593492d16
commit 4e7b58629a
16 changed files with 35 additions and 68 deletions

View File

@ -23,22 +23,24 @@ qtConfig(icu) {
SOURCES += \ SOURCES += \
codecs/qicucodec.cpp codecs/qicucodec.cpp
} else { } else {
HEADERS += \ qtConfig(big_codecs) {
codecs/qgb18030codec_p.h \ HEADERS += \
codecs/qeucjpcodec_p.h \ codecs/qgb18030codec_p.h \
codecs/qjiscodec_p.h \ codecs/qeucjpcodec_p.h \
codecs/qsjiscodec_p.h \ codecs/qjiscodec_p.h \
codecs/qeuckrcodec_p.h \ codecs/qsjiscodec_p.h \
codecs/qbig5codec_p.h codecs/qeuckrcodec_p.h \
codecs/qbig5codec_p.h
SOURCES += \ SOURCES += \
codecs/qgb18030codec.cpp \ codecs/qgb18030codec.cpp \
codecs/qjpunicode.cpp \ codecs/qjpunicode.cpp \
codecs/qeucjpcodec.cpp \ codecs/qeucjpcodec.cpp \
codecs/qjiscodec.cpp \ codecs/qjiscodec.cpp \
codecs/qsjiscodec.cpp \ codecs/qsjiscodec.cpp \
codecs/qeuckrcodec.cpp \ codecs/qeuckrcodec.cpp \
codecs/qbig5codec.cpp codecs/qbig5codec.cpp
}
qtConfig(iconv) { qtConfig(iconv) {
HEADERS += codecs/qiconvcodec_p.h HEADERS += codecs/qiconvcodec_p.h

View File

@ -41,7 +41,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
static int qt_Big5hkscsToUnicode(const uchar *s, uint *pwc); static int qt_Big5hkscsToUnicode(const uchar *s, uint *pwc);
static int qt_UnicodeToBig5hkscs(uint wc, uchar *r); 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 QT_END_NAMESPACE

View File

@ -59,9 +59,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QBig5Codec : public QTextCodec {
public: public:
@ -91,8 +91,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QBIG5CODEC_P_H #endif // QBIG5CODEC_P_H

View File

@ -76,8 +76,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
static const uchar Ss2 = 0x8e; // Single Shift 2 static const uchar Ss2 = 0x8e; // Single Shift 2
static const uchar Ss3 = 0x8f; // Single Shift 3 static const uchar Ss3 = 0x8f; // Single Shift 3
@ -255,6 +253,5 @@ QByteArray QEucJpCodec::_name()
{ {
return "EUC-JP"; return "EUC-JP";
} }
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QEucJpCodec : public QTextCodec {
public: public:
@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv; const QJpUnicodeConv *conv;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QEUCJPCODEC_P_H #endif // QEUCJPCODEC_P_H

View File

@ -72,7 +72,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
unsigned int qt_Ksc5601ToUnicode(unsigned int code); unsigned int qt_Ksc5601ToUnicode(unsigned int code);
unsigned int qt_UnicodeToKsc5601(unsigned int unicode); unsigned int qt_UnicodeToKsc5601(unsigned int unicode);
@ -3523,6 +3522,4 @@ QString QCP949Codec::convertToUnicode(const char* chars, int len, ConverterState
return result; return result;
} }
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -80,9 +80,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QEucKrCodec : public QTextCodec {
public: public:
@ -112,8 +112,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QEUCKRCODEC_P_H #endif // QEUCKRCODEC_P_H

View File

@ -45,8 +45,6 @@
#include "qgb18030codec_p.h" #include "qgb18030codec_p.h"
#ifndef QT_NO_BIG_CODECS
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define InRange(c, lower, upper) (((c) >= (lower)) && ((c) <= (upper))) #define InRange(c, lower, upper) (((c) >= (lower)) && ((c) <= (upper)))
@ -9116,5 +9114,3 @@ int qt_UnicodeToGbk(uint uni, uchar *gbchar) {
} }
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_BIG_CODECS

View File

@ -57,9 +57,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QGb18030Codec : public QTextCodec {
public: public:
@ -108,8 +108,6 @@ public:
QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QGB18030CODEC_P_H #endif // QGB18030CODEC_P_H

View File

@ -52,7 +52,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
enum { enum {
Esc = 0x1b, Esc = 0x1b,
So = 0x0e, // Shift Out So = 0x0e, // Shift Out
@ -369,6 +368,4 @@ QList<QByteArray> QJisCodec::_aliases()
return list; return list;
} }
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QJisCodec : public QTextCodec {
public: public:
@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv; const QJpUnicodeConv *conv;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QJISCODEC_P_H #endif // QJISCODEC_P_H

View File

@ -50,8 +50,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
#define USE_JISX0212 #define USE_JISX0212
#define Q_STRICT #define Q_STRICT
@ -10734,6 +10732,4 @@ uint QJpUnicodeConv::unicodeToCp932(uint h, uint l) const
\internal \internal
*/ */
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -82,9 +82,9 @@
#include <QtCore/private/qglobal_p.h> #include <QtCore/private/qglobal_p.h>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(big_codecs);
#ifndef QT_NO_BIG_CODECS QT_BEGIN_NAMESPACE
class QJpUnicodeConv { class QJpUnicodeConv {
public: public:
@ -180,8 +180,6 @@ private:
int rule; int rule;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QJPUNICODE_P_H #endif // QJPUNICODE_P_H

View File

@ -52,7 +52,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_BIG_CODECS
enum { enum {
Esc = 0x1b Esc = 0x1b
}; };
@ -223,6 +222,5 @@ QList<QByteArray> QSjisCodec::_aliases()
<< "MS_Kanji"; << "MS_Kanji";
return list; return list;
} }
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -84,9 +84,9 @@
#include <QtCore/qtextcodec.h> #include <QtCore/qtextcodec.h>
#include <QtCore/qlist.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 { class QSjisCodec : public QTextCodec {
public: public:
@ -108,8 +108,6 @@ protected:
const QJpUnicodeConv *conv; const QJpUnicodeConv *conv;
}; };
#endif // QT_NO_BIG_CODECS
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QSJISCODEC_P_H #endif // QSJISCODEC_P_H

View File

@ -69,7 +69,7 @@
# include "qwindowscodec_p.h" # include "qwindowscodec_p.h"
#endif #endif
# include "qsimplecodec_p.h" # include "qsimplecodec_p.h"
#if !defined(QT_NO_BIG_CODECS) #if QT_CONFIG(big_codecs)
# ifndef Q_OS_INTEGRITY # ifndef Q_OS_INTEGRITY
# include "qgb18030codec_p.h" # include "qgb18030codec_p.h"
# include "qeucjpcodec_p.h" # include "qeucjpcodec_p.h"
@ -78,7 +78,7 @@
# include "qeuckrcodec_p.h" # include "qeuckrcodec_p.h"
# include "qbig5codec_p.h" # include "qbig5codec_p.h"
# endif // !Q_OS_INTEGRITY # endif // !Q_OS_INTEGRITY
#endif // !QT_NO_BIG_CODECS #endif // big_codecs
#endif // icu #endif // icu
#endif // QT_BOOTSTRAPPED #endif // QT_BOOTSTRAPPED
@ -275,7 +275,7 @@ static void setup()
for (int i = 0; i < QSimpleTextCodec::numSimpleCodecs; ++i) for (int i = 0; i < QSimpleTextCodec::numSimpleCodecs; ++i)
(void)new QSimpleTextCodec(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 QGb18030Codec;
(void)new QGbkCodec; (void)new QGbkCodec;
(void)new QGb2312Codec; (void)new QGb2312Codec;
@ -286,7 +286,7 @@ static void setup()
(void)new QCP949Codec; (void)new QCP949Codec;
(void)new QBig5Codec; (void)new QBig5Codec;
(void)new QBig5hkscsCodec; (void)new QBig5hkscsCodec;
# endif // !QT_NO_BIG_CODECS && !Q_OS_INTEGRITY # endif // big_codecs && !Q_OS_INTEGRITY
#if QT_CONFIG(iconv) #if QT_CONFIG(iconv)
(void) new QIconvCodec; (void) new QIconvCodec;
#endif #endif