1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-27 18:50:07 +03:00

patch from Roumen Petrov to detect if iconv() needs a const for the second

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

svn path=/trunk/; revision=3693
This commit is contained in:
Daniel Veillard 2008-02-15 07:47:26 +00:00
parent f3da06d6f7
commit 8e1a46d526
4 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Fri Feb 15 08:45:32 CET 2008 Daniel Veillard <daniel@veillard.com>
* config.h.in configure.in encoding.c: patch from Roumen Petrov
to detect if iconv() needs a const for the second parameter
Fri Feb 15 08:41:31 CET 2008 Daniel Veillard <daniel@veillard.com>
* macos/src/XMLTestPrefix2.h win32/Makefile.msvc: EOL cleanups

View File

@ -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

View File

@ -1224,6 +1224,29 @@ iconv (cd, NULL, NULL, NULL, NULL);],[
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=""

View File

@ -1703,7 +1703,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
}
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)) {