From: Paul Cornett Date: Thu, 17 Jan 2008 05:17:24 +0000 (+0000) Subject: check for vswscanf(), AIX 5.1 and HP-UX 11.11 don't have it X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ccd96bfe8e90099e6e6e76464aa969c4ad61c1f0?hp=0273787aba66cc4e0e0107b624efcf3d87f55917 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 --- diff --git a/configure b/configure index 1e2ddc589f..119a5cf971 100755 --- a/configure +++ b/configure @@ -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; } diff --git a/configure.in b/configure.in index cddea836f0..3fb37d26b4 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/include/wx/mac/carbon/config_xcode.h b/include/wx/mac/carbon/config_xcode.h index b9468165b0..56c6aede71 100644 --- a/include/wx/mac/carbon/config_xcode.h +++ b/include/wx/mac/carbon/config_xcode.h @@ -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 diff --git a/include/wx/wxcrtvararg.h b/include/wx/wxcrtvararg.h index 386b7338ab..2e52bb23df 100644 --- a/include/wx/wxcrtvararg.h +++ b/include/wx/wxcrtvararg.h @@ -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 diff --git a/setup.h.in b/setup.h.in index 0108b6070b..4082d28d54 100644 --- a/setup.h.in +++ b/setup.h.in @@ -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 diff --git a/src/common/wxcrt.cpp b/src/common/wxcrt.cpp index c329848585..c4fcdc5a14 100644 --- a/src/common/wxcrt.cpp +++ b/src/common/wxcrt.cpp @@ -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 // ----------------------------------------------------------------------------