]> git.saurik.com Git - wxWidgets.git/commitdiff
at least partially implemented vswscanf() -- otherwise wx apps compiled against glibc...
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 26 Oct 2004 17:42:39 +0000 (17:42 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 26 Oct 2004 17:42:39 +0000 (17:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wxchar.cpp

index b99c6c7eab048db99aa1cfbc9709f1f3405407a3..f4739262b5373afac6438c484419f741f2d8ac12 100644 (file)
@@ -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)