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 ======================
|
||||||
dnl = checking for iconv =
|
dnl = checking for iconv =
|
||||||
dnl ======================
|
dnl ======================
|
||||||
if test "$prefix" = "NONE"; then
|
AC_CHECK_HEADERS([iconv.h],
|
||||||
encodings_file="${ac_default_prefix}"
|
AC_MSG_CHECKING([whether iconv takes const char **])
|
||||||
else
|
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <iconv.h>]], [[iconv(0, (const char **)0, 0, 0, 0);]]),
|
||||||
encodings_file="${prefix}"
|
AC_MSG_RESULT([yes]) AC_DEFINE([ICONV_CONST], [const], [pass const pointer to iconv]),
|
||||||
fi
|
AC_MSG_RESULT([no]) AC_DEFINE([ICONV_CONST], [], [pass non-const pointer to iconv]))
|
||||||
AC_CHECK_HEADERS([iconv.h], , AC_MSG_NOTICE(cannot find iconv.h header, iconv support will be disabled))
|
AC_CHECK_LIB(iconv, libiconv, LDFLAGS="$LDFLAGS -liconv", )
|
||||||
|
, )
|
||||||
|
|
||||||
dnl ========================
|
dnl ========================
|
||||||
dnl = checking for ncurses =
|
dnl = checking for ncurses =
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace
|
|||||||
char *outstart = outbuf;
|
char *outstart = outbuf;
|
||||||
char *instart = inbuf;
|
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;
|
delete [] outstart;
|
||||||
iconv_close(cd);
|
iconv_close(cd);
|
||||||
|
|||||||
Reference in New Issue
Block a user