Peter Kümmel <[EMAIL PROTECTED]> writes:

| Lars Gullik Bjønnes wrote:
| > Peter Kümmel <[EMAIL PROTECTED]> writes:
| > 
| > | Index: src/support/unicode.C
| > | ===================================================================
| > | --- src/support/unicode.C       (revision 14663)
| > | +++ src/support/unicode.C       (working copy)
| > | @@ -14,6 +14,8 @@
| > | 
| > |  #include "unicode.h"
| > | 
| > | +#include <iconv.h>
| > | +
| > |  #include "debug.h"
| > | 
| > |  #include <cerrno>
| > | @@ -45,7 +47,7 @@
| > |                 }
| > |         }
| > | 
| > | -       char * inbuf = const_cast<char *>(&buf[0]);
| > | +       char const * inbuf = &buf[0];
| > 
| > Won't work on linux.
| > 
| > size_t iconv(iconv_t cd,
| >              char **inbuf, size_t *inbytesleft,
| >              char **outbuf, size_t *outbytesleft);
| > 
| > 
| > I'll ask again: what is the iconv prototype on win?
| > 
| 
| It's a const pointer on windows:
| 
| extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, 
char* * outbuf, size_t *outbytesleft);
| 
| 
| Seems we have to use a ifdef.

Seems so... it may also be possible to use autoconf as a help:

/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST


char ICONV_CONST * inbuf = const_cast<char ICONV_CONST *>(&buf[0]);

ICONV_CONST will be defined as 'const' when the prototype of iconv
requires const in its first parameter. 

I'd prefere this solution.

Can you test that?
(If you are using scons you will have to make it create another test
or hardcode what ICONV_CONST should be defined as.)

-- 
        Lgb

Reply via email to