handle iconv() function that takes const char ** instead of char **
This commit is contained in:
13
configure.in
13
configure.in
@@ -33,12 +33,13 @@ AC_CHECK_HEADERS([dirent.h regex.h], , AC_MSG_ERROR(vital headers missing))
|
||||
dnl ======================
|
||||
dnl = checking for iconv =
|
||||
dnl ======================
|
||||
if test "$prefix" = "NONE"; then
|
||||
encodings_file="${ac_default_prefix}"
|
||||
else
|
||||
encodings_file="${prefix}"
|
||||
fi
|
||||
AC_CHECK_HEADERS([iconv.h], , AC_MSG_NOTICE(cannot find iconv.h header, iconv support will be disabled))
|
||||
AC_CHECK_HEADERS([iconv.h],
|
||||
AC_MSG_CHECKING([whether iconv takes const char **])
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
|
||||
AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
|
||||
AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
|
||||
AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
|
||||
, )
|
||||
|
||||
dnl ========================
|
||||
dnl = checking for ncurses =
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace
|
||||
char *outstart = outbuf;
|
||||
char *instart = inbuf;
|
||||
|
||||
if (iconv(cd, &inbuf, &len, &outbuf, &buflen) == (size_t)-1)
|
||||
if (iconv(cd, const_cast<ICONV_CONST char **>(&inbuf), &len, &outbuf, &buflen) == (size_t)-1)
|
||||
{
|
||||
delete [] outstart;
|
||||
iconv_close(cd);
|
||||
|
||||
Reference in New Issue
Block a user