On Wed, Oct 22, 2008 at 08:44:48AM -0300, Jorge Arellano Cid wrote:
On Wed, Oct 22, 2008 at 12:09:10AM +0200, Ben de Groot wrote:
Jorge Arellano Cid wrote:
On Tue, Oct 21, 2008 at 07:39:51PM +0200, Ben de Groot wrote:
% grep inbuf_t work/dillo-2.0/config.log #define inbuf_t const char
It looks like the test in configure.in detects iconv() in a strange way.
Indeed, something seems to go wrong there. My glibc version is 2.8_p20080602.
What's inconv's signature in your OS?
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf, size_t *__restrict __inbytesleft, char **__restrict __outbuf, size_t *__restrict __outbytesleft);
OK.
A "char **" not a "const char **".
Just for testing try setting [char] instead of [const char] in configure.in:348.
In our bugtracker another patch was proposed, which makes dillo compile for me. https://bugs.gentoo.org/show_bug.cgi?id=242774
--- src/form.cc 2008-10-21 21:02:31 +0000 +++ src/form.cc 2008-10-21 21:02:53 +0000 @@ -1240,8 +1240,9 @@ int rc = 0; Dstr *output; const int bufsize = 128; - inbuf_t *inPtr; - char *buffer, *outPtr; + //inbuf_t *inPtr; + //char *buffer, *outPtr; + char *buffer, *outPtr, *inPtr; size_t inLeft, outRoom; bool bad_chars = false;
Does this patch look good to you?
No.
It seems to be enough for Gentoo, but I'd prefer to detect the type of inbuf_t correctly in configure.in, so it compiles out of the box.
One could think that using char* for inPtr would work for both cases (char ** and const char ** in the declaration of iconv), but it doesn't: void test(const char **s) {}; int main(int argc, char **argv) { char *s; test(&s); } fails with const.cc: In function 'int main(int, char**)': const.cc:5: error: invalid conversion from 'char**' to 'const char**' const.cc:5: error: initializing argument 1 of 'void test(const char**)' See e.g. http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.17 for the reason why this does not work. Cheers, Johannes