From 63de666d9d9406a060bfeb712a67f5f6770d60e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 26 Oct 2004 17:42:39 +0000 Subject: [PATCH] at least partially implemented vswscanf() -- otherwise wx apps compiled against glibc 2.1 wouldn't run at all git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index b99c6c7eab..f4739262b5 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -653,9 +653,19 @@ int vwscanf(const wxChar *format, va_list argptr) int vswscanf(const wxChar *ws, const wxChar *format, va_list argptr) { - wxFAIL_MSG( _T("TODO") ); - - return -1; + // 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") ); + + va_list argcopy; + wxVaCopy(argcopy, argptr); + return vsscanf(wxConvLibc.cWX2MB(ws), wxConvLibc.cWX2MB(format), argcopy); } int vfwscanf(FILE *stream, const wxChar *format, va_list argptr) -- 2.47.2