added check for iconv() version; fixed strconv.cpp to compile with both prototypes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-04-24 22:16:24 +00:00
parent 1309ba6c7e
commit 95c8801cdf
3 changed files with 649 additions and 552 deletions

1157
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2361,8 +2361,6 @@ AC_CHECK_LIB(c, wcslen, [
dnl check for vprintf/vsprintf() which are GNU extensions
AC_FUNC_VPRINTF
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl check for vsscanf() and vsnprintf() - on some platforms (Linux, glibc
dnl 2.1.1 for the first one, HP-UX for the second) it's available in the
@@ -2475,6 +2473,28 @@ AC_LANG_RESTORE
dnl the following tests are for Unix(like) systems only
if test "$TOOLKIT" != "MSW"; then
dnl check for available version of iconv()
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CACHE_CHECK([if iconv() takes char**], wx_cv_iconv_takes_char,
[
AC_TRY_COMPILE([#include <iconv.h>],
[
char **inbuf, **outbuf;
iconv_t cd;
size_t insz, outsz;
iconv(cd, inbuf, &insz, outbuf, &outsz);
],
wx_cv_iconv_takes_char=yes,
wx_cv_iconv_takes_char=no)
])
AC_LANG_RESTORE
if test "$wx_cv_iconv_takes_char" = yes ; then
AC_DEFINE(WX_ICONV_TAKES_CHAR)
fi
dnl check for POSIX signals if we need them
if test "$wxUSE_ON_FATAL_EXCEPTION" = "yes" -a "$wxUSE_UNIX" = "yes"; then
AC_CHECK_FUNCS(sigaction)

View File

@@ -456,7 +456,11 @@ public:
if (buf)
{
// have destination buffer, convert there
#ifdef WX_ICONV_TAKES_CHAR
cres = iconv( m2w, (char**)&psz, &inbuf, (char**)&buf, &outbuf );
#else
cres = iconv( m2w, &psz, &inbuf, (char**)&buf, &outbuf );
#endif
res = n-(outbuf/SIZEOF_WCHAR_T);
// convert to native endianness
WC_BSWAP(buf, res)
@@ -469,7 +473,11 @@ public:
res = 0;
do {
buf = tbuf; outbuf = 8*SIZEOF_WCHAR_T;
#ifdef WX_ICONV_TAKES_CHAR
cres = iconv( m2w, (char**)&psz, &inbuf, (char**)&buf, &outbuf );
#else
cres = iconv( m2w, &psz, &inbuf, (char**)&buf, &outbuf );
#endif
res += 8-(outbuf/SIZEOF_WCHAR_T);
} while ((cres==(size_t)-1) && (errno==E2BIG));
}
@@ -504,7 +512,11 @@ public:
if (buf)
{
// have destination buffer, convert there
#ifdef WX_ICONV_TAKES_CHAR
cres = iconv( w2m, (char**)&psz, &inbuf, &buf, &outbuf );
#else
cres = iconv( w2m, (const char**)&psz, &inbuf, &buf, &outbuf );
#endif
res = n-outbuf;
}
else
@@ -515,7 +527,11 @@ public:
res = 0;
do {
buf = tbuf; outbuf = 16;
#ifdef WX_ICONV_TAKES_CHAR
cres = iconv( w2m, (char**)&psz, &inbuf, &buf, &outbuf );
#else
cres = iconv( w2m, (const char**)&psz, &inbuf, &buf, &outbuf );
#endif
res += 16 - outbuf;
} while ((cres==(size_t)-1) && (errno==E2BIG));
}
@@ -748,7 +764,11 @@ public:
{
size_t inbuf = strlen(psz);
size_t outbuf = n;
#ifdef WX_ICONV_TAKES_CHAR
size_t res = iconv( cnv, (char**)&psz, &inbuf, &buf, &outbuf );
#else
size_t res = iconv( cnv, &psz, &inbuf, &buf, &outbuf );
#endif
if (res==(size_t)-1) return (size_t)-1;
return n-outbuf;
}