libxml2 r3693 - trunk



Author: veillard
Date: Fri Feb 15 07:47:26 2008
New Revision: 3693
URL: http://svn.gnome.org/viewvc/libxml2?rev=3693&view=rev

Log:
* config.h.in configure.in encoding.c: patch from Roumen Petrov
  to detect if iconv() needs a const for the second parameter
Daniel


Modified:
   trunk/ChangeLog
   trunk/config.h.in
   trunk/configure.in
   trunk/encoding.c

Modified: trunk/config.h.in
==============================================================================
--- trunk/config.h.in	(original)
+++ trunk/config.h.in	Fri Feb 15 07:47:26 2008
@@ -246,6 +246,9 @@
 /* Whether __va_copy() is available */
 #undef HAVE___VA_COPY
 
+/* Define as const if the declaration of iconv() needs const. */
+#undef ICONV_CONST
+
 /* Name of package */
 #undef PACKAGE
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Feb 15 07:47:26 2008
@@ -1224,6 +1224,29 @@
 		AC_MSG_RESULT(no)
 		LIBS="${_libs}"
 		LDFLAGS="${_ldflags}"])]))
+
+	if test "$WITH_ICONV" = "1" ; then
+		AC_MSG_CHECKING([for iconv declaration])
+		AC_CACHE_VAL(xml_cv_iconv_arg2, [
+			AC_TRY_COMPILE([#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+], [], xml_cv_iconv_arg2="", xml_cv_iconv_arg2="const")])
+
+		xml_cv_iconv_decl="extern size_t iconv (iconv_t cd, $xml_cv_iconv_arg2 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
+		AC_MSG_RESULT([${xml_xxx:-
+	}$xml_cv_iconv_decl])
+		AC_DEFINE_UNQUOTED(ICONV_CONST, $xml_cv_iconv_arg2,
+			[Define as const if the declaration of iconv() needs const.])
+	fi
 fi
 case "$host" in
 	*mingw*) M_LIBS=""

Modified: trunk/encoding.c
==============================================================================
--- trunk/encoding.c	(original)
+++ trunk/encoding.c	Fri Feb 15 07:47:26 2008
@@ -1703,7 +1703,7 @@
     }
     icv_inlen = *inlen;
     icv_outlen = *outlen;
-    ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
+    ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
     *inlen -= icv_inlen;
     *outlen -= icv_outlen;
     if ((icv_inlen != 0) || (ret == -1)) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]