pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-users] iconv function


From: Rhialto
Subject: [Pan-users] iconv function
Date: Sun, 28 Oct 2012 02:43:18 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

To compile Pan on NetBSD, I have to apply the patch below. The signature
of the iconv() function apparently differs between NetBSD and Linux.

The 2nd argument needs to be a (const char **) on NetBSD, which it
already is without the cast that is in the source. With the cast, gcc
complains and terminates compilation.

It may even be better to put a check in configure for this.

$NetBSD: patch-pan_usenet-utils_mime-utils.cc,v 1.2 2012/07/13 08:16:00 marino 
Exp $

Fix build with NetBSD's iconv().

--- pan/usenet-utils/mime-utils.cc.orig 2012-06-29 22:24:54.000000000 +0000
+++ pan/usenet-utils/mime-utils.cc
@@ -77,7 +77,11 @@ namespace pan
       outbuf = out + converted;
       outleft = outlen - converted;
 
+#if defined(__NetBSD__)
+      converted = iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
+#else
       converted = iconv (cd, (char **) &inbuf, &inleft, &outbuf, &outleft);
+#endif
 
       if (converted != (size_t) -1 && errno == 0) {
         /*


[ as an aside:

Manual pages from NetBSD give this function signature:

     size_t
     iconv(iconv_t cd, const char ** restrict src, size_t * restrict srcleft,
         char ** restrict dst, size_t * restrict dstleft);

On Linux it is this:

       size_t iconv(iconv_t cd,
                    char **inbuf, size_t *inbytesleft,
                    char **outbuf, size_t *outbytesleft);

Both claim to conform to POSIX.1. They can't both be right, if there is
such a big difference between the types that the compiler terminates on
a cast between them. 

Most online manual pages for iconv seem to be Linux manpages, but
http://pubs.opengroup.org/onlinepubs/007908799/xsh/iconv.html seems to
give the answer, being from The Open Group itself.

]

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- There's no point being grown-up if you 
\X/ rhialto/at/xs4all.nl    -- can't be childish sometimes. -The 4th Doctor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]