$NetBSD: patch-ao,v 1.7 2010/01/29 18:19:09 adam Exp $ --- src/corelib/codecs/qiconvcodec.cpp.orig 2010-01-15 17:01:36.000000000 +0000 +++ src/corelib/codecs/qiconvcodec.cpp @@ -50,9 +50,14 @@ #include #include +// for __DragonFly_version +#if defined(__DragonFly__) +#include +#endif + // unistd.h is needed for the _XOPEN_UNIX macro #include -#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 #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 @@ -218,7 +226,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 @@ -305,7 +313,7 @@ QByteArray QIconvCodec::convertFromUnico char *outBytes; size_t inBytesLeft; -#if defined(GNU_LIBICONV) +#if defined(GNU_LIBICONV) || defined(__NetBSD__) const char **inBytesPtr = const_cast(&inBytes); #else char **inBytesPtr = &inBytes; @@ -451,11 +459,13 @@ iconv_t QIconvCodec::createIconv_t(const static const char empty_codeset[] = ""; 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)