summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2012-02-02 13:53:37 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-02-03 19:11:12 (GMT)
commit4672db851932db81ce5fbfca924399697b4d511e (patch)
treed140d6b4e22a5cf6124098095d7dfc3d59fbfe75 /src/corelib
parentbd5a2c94f2460b7a5802415eb701f971e5e88e76 (diff)
downloadQt-4672db851932db81ce5fbfca924399697b4d511e.zip
Qt-4672db851932db81ce5fbfca924399697b4d511e.tar.gz
Qt-4672db851932db81ce5fbfca924399697b4d511e.tar.bz2
Add support for QNX iconv implementation.
QNX implements the POSIX version of iconv (with non-const function signatures). However, it is still necessary to link with libiconv, unlike most cases. Also, its iconv_open does not know how to handle an empty string. cherry-picked from qt5/qtbase 38cba9a37fc5fe76b1549463422ab539a1b4cf24 Change-Id: Ia77633f1ddfdc8f5a8414125f8363749a6449cc8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/codecs.pri1
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/codecs/codecs.pri b/src/corelib/codecs/codecs.pri
index 46d7dd4..6bc2fa6 100644
--- a/src/corelib/codecs/codecs.pri
+++ b/src/corelib/codecs/codecs.pri
@@ -25,6 +25,7 @@ unix {
contains(QT_CONFIG,iconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
+ blackberry-*-qcc:LIBS_PRIVATE *= -liconv
} else:contains(QT_CONFIG,gnu-libiconv) {
HEADERS += codecs/qiconvcodec_p.h
SOURCES += codecs/qiconvcodec.cpp
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 428e7d4..59c77ba 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -462,8 +462,13 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from)
iconv_t cd = (iconv_t) -1;
#if defined(__GLIBC__) || defined(GNU_LIBICONV)
+#if defined(Q_OS_QNX)
+ // on QNX the default locale is UTF-8, and an empty string will cause iconv_open to fail
+ static const char empty_codeset[] = "UTF-8";
+#else
// both GLIBC and libgnuiconv will use the locale's encoding if from or to is an empty string
static const char empty_codeset[] = "";
+#endif
const char *codeset = empty_codeset;
cd = iconv_open(to ? to : codeset, from ? from : codeset);
#else