check for vswscanf(), AIX 5.1 and HP-UX 11.11 don't have it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51259 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2008-01-17 05:17:24 +00:00
parent 0273787aba
commit ccd96bfe8e
6 changed files with 30 additions and 18 deletions

2
configure vendored
View File

@ -35304,7 +35304,7 @@ done
esac
for wx_func in putws fputws wprintf vswprintf
for wx_func in putws fputws wprintf vswprintf vswscanf
do
{ echo "$as_me:$LINENO: checking for $wx_func" >&5
echo $ECHO_N "checking for $wx_func... $ECHO_C" >&6; }

View File

@ -4174,7 +4174,7 @@ if test "$wxUSE_UNICODE" = yes; then
fi
esac
WX_CHECK_FUNCS(putws fputws wprintf vswprintf,,,
WX_CHECK_FUNCS(putws fputws wprintf vswprintf vswscanf,,,
[$wchar_headers])
dnl MinGW has a vswprintf with a different prototype, and

View File

@ -101,6 +101,7 @@
#define HAVE_STRCASECMP_IN_STRING_H 1
#define HAVE_WPRINTF 1
#define HAVE_VSWPRINTF 1
#define HAVE_VSWSCANF 1
#define HAVE_FSEEKO 1
#define HAVE_SYS_SELECT_H 1

View File

@ -196,6 +196,9 @@
#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_WPRINTF)
#define wxNEED_WPRINTF
#endif
#if wxUSE_UNICODE && !defined(wxHAVE_TCHAR_SUPPORT) && !defined(HAVE_VSWSCANF)
#define wxNEED_VSWSCANF
#endif
#if defined(wxNEED_WPRINTF)
@ -232,11 +235,14 @@
int wxCRT_ScanfW(const wchar_t *format, ...);
int wxCRT_SscanfW(const wchar_t *str, const wchar_t *format, ...);
int wxCRT_FscanfW(FILE *stream, const wchar_t *format, ...);
int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
#else
#define wxCRT_ScanfW wxVMS_USE_STD wscanf
#define wxCRT_SscanfW wxVMS_USE_STD swscanf
#define wxCRT_FscanfW wxVMS_USE_STD fwscanf
#endif
#ifdef wxNEED_VSWSCANF
int wxCRT_VsscanfW(const wchar_t *str, const wchar_t *format, va_list ap);
#else
#define wxCRT_VsscanfW wxVMS_USE_STD vswscanf
#endif

View File

@ -1070,6 +1070,9 @@
/* Define this if you have _vsnwprintf */
#undef HAVE__VSNWPRINTF
/* vswscanf() */
#undef HAVE_VSWSCANF
/* Define if fseeko and ftello are available. */
#undef HAVE_FSEEKO

View File

@ -281,21 +281,6 @@ static int vwscanf(const wchar_t *format, va_list argptr)
return -1;
}
static int vswscanf(const wchar_t *ws, const wchar_t *format, va_list argptr)
{
// The best we can do without proper Unicode support in glibc is to
// convert the strings into MB representation and run ANSI version
// of the function. This doesn't work with %c and %s because of difference
// in size of char and wchar_t, though.
wxCHECK_MSG( wxStrstr(format, _T("%s")) == NULL, -1,
_T("incomplete vswscanf implementation doesn't allow %s") );
wxCHECK_MSG( wxStrstr(format, _T("%c")) == NULL, -1,
_T("incomplete vswscanf implementation doesn't allow %c") );
return vsscanf(wxConvLibc.cWX2MB(ws), wxConvLibc.cWX2MB(format), argptr);
}
static int vfwscanf(FILE *stream, const wchar_t *format, va_list argptr)
{
wxFAIL_MSG( _T("TODO") );
@ -327,6 +312,23 @@ static int vwprintf(const wchar_t *format, va_list argptr)
#endif // wxNEED_WPRINTF
#ifdef wxNEED_VSWSCANF
static int vswscanf(const wchar_t *ws, const wchar_t *format, va_list argptr)
{
// The best we can do without proper Unicode support in glibc is to
// convert the strings into MB representation and run ANSI version
// of the function. This doesn't work with %c and %s because of difference
// in size of char and wchar_t, though.
wxCHECK_MSG( wxStrstr(format, _T("%s")) == NULL, -1,
_T("incomplete vswscanf implementation doesn't allow %s") );
wxCHECK_MSG( wxStrstr(format, _T("%c")) == NULL, -1,
_T("incomplete vswscanf implementation doesn't allow %c") );
return vsscanf(wxConvLibc.cWX2MB(ws), wxConvLibc.cWX2MB(format), argptr);
}
#endif
// ----------------------------------------------------------------------------
// wxPrintf(), wxScanf() and relatives
// ----------------------------------------------------------------------------