1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-12 09:17:37 +03:00

Remove ICONV_CONST test

We can simply cast the offending pointer to (void *).
This commit is contained in:
Nick Wellnhofer 2022-03-04 01:07:40 +01:00
parent 1a112c7ba2
commit 21ddad5284
7 changed files with 4 additions and 53 deletions

View File

@ -194,23 +194,6 @@ else()
check_include_files(unistd.h HAVE_UNISTD_H)
check_function_exists(va_copy HAVE_VA_COPY)
check_function_exists(__va_copy HAVE___VA_COPY)
check_c_source_compiles("
#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
int main() { return 0; }
" ICONV_CONST_TEST)
if(NOT ICONV_CONST_TEST)
set(ICONV_CONST "const")
endif()
set(LT_OBJDIR ".libs/")
check_c_source_compiles("
#include <sys/socket.h>

View File

@ -123,9 +123,6 @@
/* Whether __va_copy() is available */
#cmakedefine HAVE___VA_COPY 1
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST @ICONV_CONST@
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#cmakedefine LT_OBJDIR "@LT_OBJDIR@"

View File

@ -1370,29 +1370,6 @@ 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_COMPILE_IFELSE([AC_LANG_PROGRAM([[#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

@ -1840,7 +1840,10 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
}
icv_inlen = *inlen;
icv_outlen = *outlen;
ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
/*
* Some versions take const, other versions take non-const input.
*/
ret = iconv(cd, (void *) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
*inlen -= icv_inlen;
*outlen -= icv_outlen;
if ((icv_inlen != 0) || (ret == (size_t) -1)) {

View File

@ -12,10 +12,6 @@
#include <libxml/xmlversion.h>
#ifndef ICONV_CONST
#define ICONV_CONST const
#endif
/*
* Windows platforms may define except
*/

View File

@ -119,9 +119,6 @@
/* Whether __va_copy() is available */
#undef HAVE___VA_COPY
/* Define as const if the declaration of iconv() needs const. */
#define ICONV_CONST
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR

View File

@ -11,8 +11,6 @@
#undef HAVE_LIBHISTORY
#undef HAVE_LIBREADLINE
#define ICONV_CONST
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H