Martin Storsjo : ucrtbase: Handle the _s variant of vsscanf.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 4 09:40:40 CST 2015


Module: wine
Branch: master
Commit: 1fecaae9737563ef649c7c226dfbabc747852994
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1fecaae9737563ef649c7c226dfbabc747852994

Author: Martin Storsjo <martin at martin.st>
Date:   Tue Nov  3 20:40:41 2015 +0200

ucrtbase: Handle the _s variant of vsscanf.

Signed-off-by: Martin Storsjo <martin at martin.st>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/msvcrt.h |  2 ++
 dlls/msvcrt/scanf.c  | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 4ce8202..77f612e 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -1139,4 +1139,6 @@ extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,
 #define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS            (0x0002)
 #define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY       (0x0004)
 
+#define UCRTBASE_SCANF_MASK                              (0x0007)
+
 #endif /* __WINE_MSVCRT_H */
diff --git a/dlls/msvcrt/scanf.c b/dlls/msvcrt/scanf.c
index b02977f..a19d450 100644
--- a/dlls/msvcrt/scanf.c
+++ b/dlls/msvcrt/scanf.c
@@ -671,9 +671,15 @@ int CDECL MSVCRT__stdio_common_vsscanf(unsigned __int64 options,
                                        MSVCRT__locale_t locale,
                                        __ms_va_list valist)
 {
-    if (options != UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS)
+    /* LEGACY_WIDE_SPECIFIERS only has got an effect on the wide
+     * scanf. LEGACY_MSVCRT_COMPATIBILITY affects parsing of nan/inf,
+     * but parsing of those isn't implemented at all yet. */
+    if (options & ~UCRTBASE_SCANF_MASK)
         FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
-    return MSVCRT_vsnscanf_l(input, length, format, locale, valist);
+    if (options & UCRTBASE_SCANF_SECURECRT)
+        return MSVCRT_vsnscanf_s_l(input, length, format, locale, valist);
+    else
+        return MSVCRT_vsnscanf_l(input, length, format, locale, valist);
 }
 
 /*********************************************************************




More information about the wine-cvs mailing list