diff options
author | jcid <devnull@localhost> | 2008-03-14 19:04:18 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-03-14 19:04:18 +0100 |
commit | 37daa9291e959f4bebffc3d534f2c0ac38819e58 (patch) | |
tree | 55f363967525c406ecc94d7011a07d1f4bfeb33b | |
parent | f6fab73d9f4f53fa1326fac45a344db1d4390e6a (diff) |
- Added suport for old iconv() (const char** as 2nd arg).
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | config.h.in | 3 | ||||
-rw-r--r-- | configure.in | 58 | ||||
-rw-r--r-- | src/decode.c | 3 | ||||
-rw-r--r-- | src/html.cc | 3 |
5 files changed, 67 insertions, 2 deletions
@@ -99,6 +99,8 @@ dillo-fltk2 Patch: Jorge Arellano Cid, higuita +- Set the url resolver to escape illegal chars instead of stripping. Patch: Jorge Arellano Cid, Jeremy Henty ++- Added suport for old iconv() (const char** as 2nd arg). + Patch: Jorge Arellano Cid, Christian Kellermann +- Added a strndup() replacement in dw2 Patch: Alexander Becher, Johannes Hofmann, Jorge Arellano Cid +- Fixed calcHashValue() to only return non-negative numbers (was SEGFAULT). diff --git a/config.h.in b/config.h.in index f2a30dc7..767c86e4 100644 --- a/config.h.in +++ b/config.h.in @@ -102,5 +102,8 @@ /* Version number of package */ #undef VERSION +/* Use char pointers for newer libiconv */ +#undef inbuf_t + /* Define the real type of socklen_t */ #undef socklen_t diff --git a/configure.in b/configure.in index 4ca4549f..a27b20df 100644 --- a/configure.in +++ b/configure.in @@ -325,6 +325,64 @@ if test "x$iconv_ok" = "xno"; then fi dnl ---------------------- +dnl Check if we need to +dnl support the old +dnl iconv interface +dnl ---------------------- +if test "x$iconv_ok" = "xyes"; then + old_libs="$LIBS" + LIBS="$old_libs $LIBICONV_LIBS" + old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([#include <iconv.h>], +[ + 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); +], +iconv_old=yes,iconv_old=no) + LIBS="$old_libs" + CLFAGS="$old_cflags" + + if test "x$iconv_old" = "xyes"; then + AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv]) + else + AC_DEFINE([inbuf_t], [char], [Use char pointers for newer libiconv]) + fi +fi + +dnl ---------------------- +dnl Check if we need to +dnl support the old +dnl iconv interface +dnl ---------------------- +if test "x$iconv_ok" = "xyes"; then + old_libs="$LIBS" + LIBS="$old_libs $LIBICONV_LIBS" + old_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_TRY_COMPILE([#include <iconv.h>], +[ + 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); +], +iconv_old=yes,iconv_old=no) + LIBS="$old_libs" + CLFAGS="$old_cflags" + + if test "x$iconv_old" = "xyes"; then + AC_DEFINE([inbuf_t], [const char], [Use const char pointers for older libiconv]) + else + AC_DEFINE([inbuf_t], [char], [Use char pointers for newer libiconv]) + fi +fi + +dnl ---------------------- dnl Test for POSIX threads dnl ---------------------- dnl diff --git a/src/decode.c b/src/decode.c index 94d3ba3f..1bc54372 100644 --- a/src/decode.c +++ b/src/decode.c @@ -143,7 +143,8 @@ static Dstr *Decode_charset(Decode *dc, Dstr *input) int rc = 0; Dstr *output; - char *inPtr, *outPtr; + inbuf_t *inPtr; + char *outPtr; size_t inLeft, outRoom; output = dStr_new(""); diff --git a/src/html.cc b/src/html.cc index 6564a5f9..e2710450 100644 --- a/src/html.cc +++ b/src/html.cc @@ -3844,7 +3844,8 @@ static Dstr *Html_encode_text(iconv_t encoder, Dstr *input) int rc = 0; Dstr *output; const int bufsize = 128; - char *buffer, *inPtr, *outPtr; + inbuf_t *inPtr; + char *buffer, *outPtr; size_t inLeft, outRoom; bool bad_chars = false; |