From 4400c1a4507626e9336771a018a308510ff52649 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Tue, 13 Apr 1999 12:29:59 +0000 Subject: [PATCH] Fixed a typo. Added sloppy implementation of wxSscanf (converts source and format, then calls vsscanf; use only on number arguments!) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2138 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 1307daaf50..3f70fe66dc 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -24,6 +24,9 @@ #pragma hdrstop #endif +#define _ISOC9X_SOURCE 1 // to get vsscanf() +#define _BSD_SOURCE 1 // to still get strdup() + #include #include #include @@ -137,7 +140,7 @@ int WXDLLEXPORT wxFprintf(FILE *stream, const wxChar *fmt, ...) int ret; va_start(argptr, fmt); - ret = wxFvprintf(stream, fmt, argptr); + ret = wxVfprintf(stream, fmt, argptr); va_end(argptr); return ret; } @@ -170,6 +173,26 @@ int WXDLLEXPORT wxVsprintf(wxChar *buf, const wxChar *fmt, va_list argptr) wxStrcpy(buf,str.c_str()); return str.Len(); } + +int WXDLLEXPORT wxSscanf(const wxChar *buf, const wxChar *fmt, ...) +{ + va_list argptr; + int ret; + + va_start(argptr, fmt); + ret = wxVsscanf(buf, fmt, argptr); + va_end(argptr); + return ret; +} + +int WXDLLEXPORT wxVsscanf(const wxChar *buf, const wxChar *fmt, va_list argptr) +{ + int ret; + // this will work only for numeric conversion! Strings will not be converted correctly + // hopefully this is all we'll need + ret = vsscanf(wxConv_libc.cWX2MB(buf), wxConv_libc.cWX2MB(fmt), argptr); + return ret; +} #endif #ifndef wxAtof -- 2.45.2