handle iconv() function that takes const char ** instead of char **

master
Andrzej Rybczak 17 years ago
parent 343f778256
commit dd471ef1c6
  1. 13
      configure.in
  2. 2
      src/charset.cpp

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

Loading…
Cancel
Save