pkgsrc/x11/qt4-libs/patches/patch-ao
adam a6263d516d Changes 4.8.1:
Qt 4.8.1 is the first patch release to the 4.8 series with over 200 functional
improvements to the desktop and embedded platforms. The majority of the error
corrections, made primarily by Digia, have been on desktop and embedded
platforms with a large number of fixes with focus on QtCore, QtGUI and
QtNetwork. These fixes benefit all desktop platforms. Qt 4.8.1 also includes
Mac App Store support.
2012-04-09 09:12:49 +00:00

72 lines
2.3 KiB
Text

$NetBSD: patch-ao,v 1.10 2012/04/09 09:12:49 adam Exp $
--- src/corelib/codecs/qiconvcodec.cpp.orig 2012-03-14 14:01:18.000000000 +0000
+++ src/corelib/codecs/qiconvcodec.cpp
@@ -50,9 +50,14 @@
#include <stdio.h>
#include <dlfcn.h>
+// for __DragonFly_version
+#if defined(__DragonFly__)
+#include <sys/param.h>
+#endif
+
// unistd.h is needed for the _XOPEN_UNIX macro
#include <unistd.h>
-#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)
+#if (defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)) || defined(Q_OS_NETBSD) || defined(__DragonFly__)
# include <langinfo.h>
#endif
@@ -69,6 +74,9 @@
# else
# define UTF16 "UTF-16LE"
# endif
+#elif defined(__DragonFly__) && __DragonFly_version__ < 197700
+# define NO_BOM
+# define UTF16 "UTF-16"
#else
# define UTF16 "UTF-16"
#endif
@@ -219,7 +227,7 @@ QString QIconvCodec::convertToUnicode(co
IconvState *state = *pstate;
size_t inBytesLeft = len;
// best case assumption, each byte is converted into one UTF-16 character, plus 2 bytes for the BOM
-#ifdef GNU_LIBICONV
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
// GNU doesn't disagree with POSIX :/
const char *inBytes = chars;
#else
@@ -318,7 +326,7 @@ static bool setByteOrder(iconv_t cd)
size_t outBytesLeft = sizeof buf;
size_t inBytesLeft = sizeof bom;
-#if defined(GNU_LIBICONV)
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
const char **inBytesPtr = const_cast<const char **>(&inBytes);
#else
char **inBytesPtr = &inBytes;
@@ -338,7 +346,7 @@ QByteArray QIconvCodec::convertFromUnico
char *outBytes;
size_t inBytesLeft;
-#if defined(GNU_LIBICONV)
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
const char **inBytesPtr = const_cast<const char **>(&inBytes);
#else
char **inBytesPtr = &inBytes;
@@ -475,11 +483,13 @@ iconv_t QIconvCodec::createIconv_t(const
#endif
const char *codeset = empty_codeset;
cd = iconv_open(to ? to : codeset, from ? from : codeset);
+#elif defined(__NetBSD)
+ const char *codeset = 0;
#else
char *codeset = 0;
#endif
-#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)
+#if (defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)) || defined(Q_OS_NETBSD) || defined(__DragonFly__)
if (cd == (iconv_t) -1) {
codeset = nl_langinfo(CODESET);
if (codeset)