From 7ee3d8c8ecb78dd7c5ae09b04ebf1420958f0001 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Mon, 4 Jul 2011 00:42:24 +0200 Subject: [PATCH] build and load text codecs regardless of iconv and platform Otherwise applications linking to static Qt may have to import the static plugins to avoid linking failure even if they do not use the codecs, which is a nuisance. Also, this is preparation for moving these codecs into QtCore proper. Change-Id: I71f3bbb0bac6261983143d0578757b34997d1364 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/corelib/codecs/codecs.pri | 38 ++++++++++++++----------------- src/corelib/codecs/qtextcodec.cpp | 14 ++++-------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri index 0495d784e5..934242e49b 100644 --- a/src/corelib/codecs/codecs.pri +++ b/src/corelib/codecs/codecs.pri @@ -8,7 +8,14 @@ HEADERS += \ codecs/qtextcodec.h \ codecs/qtsciicodec_p.h \ codecs/qutfcodec_p.h \ - codecs/qtextcodecplugin.h + codecs/qtextcodecplugin.h \ + ../plugins/codecs/cn/qgb18030codec.h \ + ../plugins/codecs/jp/qeucjpcodec.h \ + ../plugins/codecs/jp/qjiscodec.h \ + ../plugins/codecs/jp/qsjiscodec.h \ + ../plugins/codecs/kr/qeuckrcodec.h \ + ../plugins/codecs/tw/qbig5codec.h \ + ../plugins/codecs/jp/qfontjpcodec.h SOURCES += \ codecs/qisciicodec.cpp \ @@ -17,7 +24,15 @@ SOURCES += \ codecs/qtextcodec.cpp \ codecs/qtsciicodec.cpp \ codecs/qutfcodec.cpp \ - codecs/qtextcodecplugin.cpp + codecs/qtextcodecplugin.cpp \ + ../plugins/codecs/cn/qgb18030codec.cpp \ + ../plugins/codecs/jp/qjpunicode.cpp \ + ../plugins/codecs/jp/qeucjpcodec.cpp \ + ../plugins/codecs/jp/qjiscodec.cpp \ + ../plugins/codecs/jp/qsjiscodec.cpp \ + ../plugins/codecs/kr/qeuckrcodec.cpp \ + ../plugins/codecs/tw/qbig5codec.cpp \ + ../plugins/codecs/jp/qfontjpcodec.cpp unix { SOURCES += codecs/qfontlaocodec.cpp @@ -34,24 +49,5 @@ unix { HEADERS += codecs/qiconvcodec_p.h SOURCES += codecs/qiconvcodec.cpp DEFINES += GNU_LIBICONV - } else { - # no iconv, so we put all plugins in the library - HEADERS += \ - ../plugins/codecs/cn/qgb18030codec.h \ - ../plugins/codecs/jp/qeucjpcodec.h \ - ../plugins/codecs/jp/qjiscodec.h \ - ../plugins/codecs/jp/qsjiscodec.h \ - ../plugins/codecs/kr/qeuckrcodec.h \ - ../plugins/codecs/tw/qbig5codec.h \ - ../plugins/codecs/jp/qfontjpcodec.h - SOURCES += \ - ../plugins/codecs/cn/qgb18030codec.cpp \ - ../plugins/codecs/jp/qjpunicode.cpp \ - ../plugins/codecs/jp/qeucjpcodec.cpp \ - ../plugins/codecs/jp/qjiscodec.cpp \ - ../plugins/codecs/jp/qsjiscodec.cpp \ - ../plugins/codecs/kr/qeuckrcodec.cpp \ - ../plugins/codecs/tw/qbig5codec.cpp \ - ../plugins/codecs/jp/qfontjpcodec.cpp } } diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 465caea62f..a5e91c5c95 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -65,15 +65,14 @@ # include "qtsciicodec_p.h" # include "qisciicodec_p.h" #if !defined(Q_OS_INTEGRITY) -# if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) -// no iconv(3) support, must build all codecs into the library +# if !defined(QT_BOOTSTRAPPED) # include "../../plugins/codecs/cn/qgb18030codec.h" # include "../../plugins/codecs/jp/qeucjpcodec.h" # include "../../plugins/codecs/jp/qjiscodec.h" # include "../../plugins/codecs/jp/qsjiscodec.h" # include "../../plugins/codecs/kr/qeuckrcodec.h" # include "../../plugins/codecs/tw/qbig5codec.h" -# endif // QT_NO_ICONV +# endif // !QT_BOOTSTRAPPED # if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED) # include "qfontlaocodec_p.h" # include "../../plugins/codecs/jp/qfontjpcodec.h" @@ -730,8 +729,6 @@ static void setup() # if defined(Q_OS_UNIX) && !defined(QT_BOOTSTRAPPED) // no font codecs when bootstrapping (void)new QFontLaoCodec; -# if defined(QT_NO_ICONV) - // no iconv(3) support, must build all codecs into the library (void)new QFontGb2312Codec; (void)new QFontGbkCodec; (void)new QFontGb18030_0Codec; @@ -740,12 +737,11 @@ static void setup() (void)new QFontKsc5601Codec; (void)new QFontBig5hkscsCodec; (void)new QFontBig5Codec; -# endif // QT_NO_ICONV && !QT_BOOTSTRAPPED -# endif // Q_OS_UNIX +# endif // Q_OS_UNIX && !QT_BOOTSTRAPPED #if !defined(Q_OS_INTEGRITY) -# if defined(QT_NO_ICONV) && !defined(QT_BOOTSTRAPPED) +# if !defined(QT_BOOTSTRAPPED) // no asian codecs when bootstrapping, sorry (void)new QGb18030Codec; (void)new QGbkCodec; @@ -757,7 +753,7 @@ static void setup() (void)new QCP949Codec; (void)new QBig5Codec; (void)new QBig5hkscsCodec; -# endif // QT_NO_ICONV && !QT_BOOTSTRAPPED +# endif // !QT_BOOTSTRAPPED #endif // !Q_OS_INTEGRITY #endif // QT_NO_CODECS