libiconv fix for OpenBSD
Dear List, let me again thank you for your great efforts! One minor thing I stumbled upon today's update: My System has the following iconv signature: size_t iconv (iconv_t cd, const char* * inbuf, size_t * inbytesleft, char* * outbuf, size_t * outbytesleft); I therefore need something like the following to make dillo compile (an work) again: Index: src/html.cc =================================================================== RCS file: /sfhome/cvs/dillo/dillo2/src/html.cc,v retrieving revision 1.48 diff -b -u -p -r1.48 html.cc --- src/html.cc 13 Mar 2008 14:58:44 -0000 1.48 +++ src/html.cc 13 Mar 2008 21:43:26 -0000 @@ -3844,7 +3844,8 @@ static Dstr *Html_encode_text(iconv_t en int rc = 0; Dstr *output; const int bufsize = 128; - char *buffer, *inPtr, *outPtr; + const char *inPtr; + char *buffer, *outPtr; size_t inLeft, outRoom; bool bad_chars = false; I hope this does not break other systems. Kind regards, Christian -- You may use my gpg key for replies: pub 1024D/47F79788 2005/02/02 Christian Kellermann (C-Keen)
On Thu, Mar 13, 2008 at 10:35:23PM +0100, Christian Kellermann wrote:
Dear List,
let me again thank you for your great efforts! One minor thing I stumbled upon today's update: My System has the following iconv signature: size_t iconv (iconv_t cd, const char* * inbuf, size_t * inbytesleft, char* * outbuf, size_t * outbytesleft);
I therefore need something like the following to make dillo compile (an work) again:
Index: src/html.cc =================================================================== RCS file: /sfhome/cvs/dillo/dillo2/src/html.cc,v retrieving revision 1.48 diff -b -u -p -r1.48 html.cc --- src/html.cc 13 Mar 2008 14:58:44 -0000 1.48 +++ src/html.cc 13 Mar 2008 21:43:26 -0000 @@ -3844,7 +3844,8 @@ static Dstr *Html_encode_text(iconv_t en int rc = 0; Dstr *output; const int bufsize = 128; - char *buffer, *inPtr, *outPtr; + const char *inPtr; + char *buffer, *outPtr; size_t inLeft, outRoom; bool bad_chars = false;
You will also need to patch decode.c.
I hope this does not break other systems.
Unfortunately it does. Your system conforms to the old standard: http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html Glibc conforms to the new one: http://www.opengroup.org/onlinepubs/009695399/functions/iconv.html One way I see to overcome this in Dillo is to define an inbuf_t from autoconf, and to use it in html.cc and decode.cc. If configure.in checks for a longer program, like: #include <iconv.h> int main(void) { const char *inPtr; char *outPtr; size_t inLeft = 0, outRoom = 0; iconv_t encoder = iconv_open("ASCII", "UTF-8"); iconv(encoder, &inPtr, &inLeft, &outPtr, &outRoom); return 0; } using gcc -Werror, if it passes, #define inbuf_t const char You can try this in your system. (but first check a simple "#define inbuf_t const char" in config.h, plus the respective patch). -- Cheers Jorge.-
On Fri, Mar 14, 2008 at 05:52:05PM +0100, Christian Kellermann wrote:
* Jorge Arellano Cid <jcid@dillo.org> [080314 16:06]:
I hope this does not break other systems.
Unfortunately it does.
You can try this in your system. (but first check a simple "#define inbuf_t const char" in config.h, plus the respective patch).
Thanks for the clarification! This is my first stab at autoconf so please bear with me. I have attached a patch that addresses this issue. I am not so sure if it handles the case of the newer interface well. Obvoiously I cannot test it. Could someone else give this a try?
Thanks again,
It works here! Committed. (now, we'll wait to see if it works OK for everybody else ;). -- Cheers Jorge.-
* Jorge Arellano Cid <jcid@dillo.org> [080314 19:11]:
Committed.
(now, we'll wait to see if it works OK for everybody else ;).
Unfortunately this introduces -Werror and thus may break the build. This is due to a silly typo. My apologies... Index: configure.in =================================================================== RCS file: /sfhome/cvs/dillo/dillo2/configure.in,v retrieving revision 1.7 diff -b -u -p -r1.7 configure.in --- configure.in 14 Mar 2008 18:04:19 -0000 1.7 +++ configure.in 14 Mar 2008 18:44:05 -0000 @@ -344,7 +344,7 @@ if test "x$iconv_ok" = "xyes"; then ], iconv_old=yes,iconv_old=no) LIBS="$old_libs" - CLFAGS="$old_cflags" + CFLAGS="$old_cflags" if test "x$iconv_old" = "xyes"; then AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv]) Thanks, Christian -- You may use my gpg key for replies: pub 1024D/47F79788 2005/02/02 Christian Kellermann (C-Keen)
On Fri, Mar 14, 2008 at 07:34:29PM +0100, Christian Kellermann wrote:
* Jorge Arellano Cid <jcid@dillo.org> [080314 19:11]:
Committed.
(now, we'll wait to see if it works OK for everybody else ;).
Unfortunately this introduces -Werror and thus may break the build. This is due to a silly typo. My apologies...
Index: configure.in =================================================================== RCS file: /sfhome/cvs/dillo/dillo2/configure.in,v retrieving revision 1.7 diff -b -u -p -r1.7 configure.in --- configure.in 14 Mar 2008 18:04:19 -0000 1.7 +++ configure.in 14 Mar 2008 18:44:05 -0000 @@ -344,7 +344,7 @@ if test "x$iconv_ok" = "xyes"; then ], iconv_old=yes,iconv_old=no) LIBS="$old_libs" - CLFAGS="$old_cflags" + CFLAGS="$old_cflags"
if test "x$iconv_old" = "xyes"; then AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv])
Thanks,
Christian
Committed, but in two places! -- Cheers Jorge.-
* Jorge Arellano Cid <jcid@dillo.org> [080314 21:40]:
Committed, but in two places!
Yeah I have seen it. Why is the same code duplicated? Once should be enough. My original patch contained such one instance of the tests... Kind regards, Christian -- You may use my gpg key for replies: pub 1024D/47F79788 2005/02/02 Christian Kellermann (C-Keen)
Hi, On Sat, Mar 15, 2008 at 12:06:17AM +0100, Christian Kellermann wrote:
* Jorge Arellano Cid <jcid@dillo.org> [080314 21:40]:
Committed, but in two places!
Yeah I have seen it. Why is the same code duplicated? Once should be enough. My original patch contained such one instance of the tests...
When applying the patch, it failed (I don't know why). After a few tries I decided to patch by hand. Redundance removed, and committed. -- Cheers Jorge.-
participants (2)
-
Christian.Kellermann@nefkom.net
-
jcid@dillo.org