1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
$NetBSD: patch-ao,v 1.5 2008/10/26 14:02:33 adam Exp $
--- src/corelib/codecs/qiconvcodec.cpp.orig 2008-09-27 10:58:46.000000000 +0200
+++ src/corelib/codecs/qiconvcodec.cpp
@@ -44,9 +44,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_QNX6) && !defined(Q_OS_OSF)
+#if (defined(_XOPEN_UNIX) && !defined(Q_OS_QNX6) && !defined(Q_OS_OSF)) || defined(Q_OS_NETBSD) || defined(__DragonFly__)
# include <langinfo.h>
#endif
@@ -63,6 +68,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
@@ -146,7 +154,7 @@ QString QIconvCodec::convertToUnicode(co
QByteArray ba;
size_t outBytesLeft = len * 2 + 2;
ba.resize(outBytesLeft);
-#ifdef GNU_LIBICONV
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
// GNU doesn't disagree with POSIX :/
const char *inBytes = chars;
#else
@@ -206,7 +214,7 @@ QByteArray QIconvCodec::convertFromUnico
ba.resize(outBytesLeft);
char *outBytes = ba.data();
-#if defined(GNU_LIBICONV)
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
const char *inBytes;
#else
char *inBytes;
@@ -216,7 +224,7 @@ QByteArray QIconvCodec::convertFromUnico
#if !defined(NO_BOM)
// give iconv() a BOM
QChar bom[] = { QChar(QChar::ByteOrderMark) };
-#ifdef GNU_LIBICONV
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
// GNU doesn't disagree with POSIX :/
inBytes = reinterpret_cast<const char *>(bom);
#else
@@ -230,7 +238,7 @@ QByteArray QIconvCodec::convertFromUnico
#endif // NO_BOM
// now feed iconv() the real data
-#ifdef GNU_LIBICONV
+#if defined(GNU_LIBICONV) || defined(__NetBSD__)
// GNU doesn't disagree with POSIX :/
inBytes = reinterpret_cast<const char *>(uc);
#else
@@ -296,7 +304,7 @@ iconv_t QIconvCodec::createIconv_t(const
char *codeset = 0;
#endif
-#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX6) && !defined(Q_OS_OSF)
+#if (defined(_XOPEN_UNIX) && !defined(Q_OS_QNX6) && !defined(Q_OS_OSF)) || defined(Q_OS_NETBSD) || defined(__DragonFly__)
if (cd == (iconv_t) -1) {
codeset = nl_langinfo(CODESET);
if (codeset)
|