libmutt's use of iconv.h



sigh,

the file libmutt/charset.h incorrectly assumes that iconv.h defines the symbol 
ICONV_CONST.  This is merely part of the GNU libiconv implementation and even 
then it isn't defined for public consumption.  ICONV_CONST seems to be part of 
a kludgy workaround to make GNU libiconv match the platforms native iconv 
implementation when there is one.

The attached patch, against this morning's cvs, restores sanity to the world 
and persuades balsa that it's alright to compile.

FYI,

SUSv3/Posix states that iconv.h declares iconv_t and functions as follows...

iconv_t iconv_open (const char *tocode, const char *fromcode);
size_t  iconv (iconv_t cd,
                char **restrict inbuf, size_t *restrict inbytesleft,
                char **restrict outbuf, size_t *restrict outbytesleft);
int     iconv_close (iconv_t cd);

(I added parameter names)

No other symbols are defined in iconv.h and therefore one must not rely on 
availability of anything other than iconv_t, iconv_open, iconv and iconv_close.

Brian

PS  I cannot understand why SUS3/Posix drops the const from the declaration of 
the inbuf argument to iconv().  This implies to me that there might be an 
implementation of iconv that alters the content of inbuf as it performs its 
processing.  If anyone can shed light on this issue I'd be interested to know.

Index: libmutt/charset.h
===================================================================
RCS file: /cvs/gnome/balsa/libmutt/charset.h,v
retrieving revision 1.4
diff -u -r1.4 charset.h
--- libmutt/charset.h   30 May 2002 18:39:10 -0000      1.4
+++ libmutt/charset.h   31 May 2002 08:33:14 -0000
@@ -27,6 +27,10 @@
 typedef void *iconv_t;
 #endif
 
+#ifndef ICONV_CONST
+#define ICONV_CONST    const
+#endif
+
 #ifndef HAVE_ICONV
 iconv_t iconv_open (const char *, const char *);
 size_t iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *);


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