Re: gwlib/charset patch
Martin Conte Mac Donell <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Mar 2, 2009 at 1:11 AM, Nikos Balkanas <[email protected]> wrote: > Martin, > > The only valid argument against the patch would be that (const char **) > causes warnings to other systems. If it does not, why not apply it to keep > everybody, including Solaris and OSX, happy? > > It is not an alternative to change libiconv sources or configuration, > especially if it doesn't make a difference for kannel. > > BR, > Nikos I'm not saying that we need to change libiconv. What i'm saying is that the "right way" to get over this warning is using a compiler conditional inside kannel. See my attached example. M.
charset_patch.diff
(application/octet-stream, 872 B)
Index: gwlib/charset.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/charset.c,v
retrieving revision 1.30
diff -u -w -b -B -r1.30 charset.c
--- gwlib/charset.c 1 Mar 2009 23:09:32 -0000 1.30
+++ gwlib/charset.c 2 Mar 2009 03:53:03 -0000
@@ -69,6 +69,12 @@
#include <iconv.h>
#endif
+#if defined(__APPLE__) || defined(OPENBSD)
+#define ICONV_CONST const
+#else
+#define ICONV_CONST
+#endif
+
/* Code used for non-representable characters */
#define NRP '?'
@@ -616,7 +622,7 @@
pointer = to_buf = gw_malloc(outbytesleft);
do {
- ret = iconv(cd, &from_buf, &inbytesleft, &pointer, &outbytesleft);
+ ret = iconv(cd, (ICONV_CONST char**)&from_buf, &inbytesleft, &pointer, &outbytesleft);
if(ret == -1) {
long tmp;
/* the conversion failed somewhere */