From 4e7b58629a0a431fbd5c0ba287c3958efd05da13 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 13 Sep 2018 12:45:20 +0200 Subject: Modernize the "big_codecs" feature Change-Id: Ic23f4a1f81a21711cd81aaa2942b493aca5b38b8 Reviewed-by: Edward Welbourne Reviewed-by: Oswald Buddenhagen --- src/corelib/codecs/codecs.pri | 32 +++++++++++++++++--------------- src/corelib/codecs/qbig5codec.cpp | 2 -- src/corelib/codecs/qbig5codec_p.h | 6 ++---- src/corelib/codecs/qeucjpcodec.cpp | 3 --- src/corelib/codecs/qeucjpcodec_p.h | 6 ++---- src/corelib/codecs/qeuckrcodec.cpp | 3 --- src/corelib/codecs/qeuckrcodec_p.h | 6 ++---- src/corelib/codecs/qgb18030codec.cpp | 4 ---- src/corelib/codecs/qgb18030codec_p.h | 6 ++---- src/corelib/codecs/qjiscodec.cpp | 3 --- src/corelib/codecs/qjiscodec_p.h | 6 ++---- src/corelib/codecs/qjpunicode.cpp | 4 ---- src/corelib/codecs/qjpunicode_p.h | 6 ++---- src/corelib/codecs/qsjiscodec.cpp | 2 -- src/corelib/codecs/qsjiscodec_p.h | 6 ++---- src/corelib/codecs/qtextcodec.cpp | 8 ++++---- 16 files changed, 35 insertions(+), 68 deletions(-) (limited to 'src/corelib/codecs') diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index dc8974d13f..5af388a149 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -23,22 +23,24 @@ qtConfig(icu) { 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 + 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 + 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 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..2db8377ee3 100644 --- a/src/corelib/codecs/qbig5codec_p.h +++ b/src/corelib/codecs/qbig5codec_p.h @@ -59,9 +59,9 @@ #include #include -QT_BEGIN_NAMESPACE +QT_REQUIRE_CONFIG(big_codecs); -#ifndef QT_NO_BIG_CODECS +QT_BEGIN_NAMESPACE class QBig5Codec : public QTextCodec { public: @@ -91,8 +91,6 @@ public: QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const; }; -#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 98ad286e9e..535e830ad0 100644 --- a/src/corelib/codecs/qeucjpcodec_p.h +++ b/src/corelib/codecs/qeucjpcodec_p.h @@ -84,9 +84,9 @@ #include #include -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 2cf950a350..9e85ca8c20 100644 --- a/src/corelib/codecs/qeuckrcodec_p.h +++ b/src/corelib/codecs/qeuckrcodec_p.h @@ -80,9 +80,9 @@ #include #include -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; }; -#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 dd136aeddb..2fea21b5b3 100644 --- a/src/corelib/codecs/qgb18030codec_p.h +++ b/src/corelib/codecs/qgb18030codec_p.h @@ -57,9 +57,9 @@ #include #include -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; }; -#endif // QT_NO_BIG_CODECS - QT_END_NAMESPACE #endif // QGB18030CODEC_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 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 4db8728817..c3eda25bdf 100644 --- a/src/corelib/codecs/qjiscodec_p.h +++ b/src/corelib/codecs/qjiscodec_p.h @@ -84,9 +84,9 @@ #include #include -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 0209843ecf..a3f3448bb6 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 -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/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 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 7dfa6f7fe4..9d7ea5d6d2 100644 --- a/src/corelib/codecs/qsjiscodec_p.h +++ b/src/corelib/codecs/qsjiscodec_p.h @@ -84,9 +84,9 @@ #include #include -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/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 1541c498e6..58fc72c9ce 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -69,7 +69,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" @@ -78,7 +78,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 @@ -275,7 +275,7 @@ static void setup() 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; @@ -286,7 +286,7 @@ 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 -- cgit v1.2.3