Commit 405e6eb3 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Added _snscanf implementation.

parent 220b6ab3
......@@ -1093,10 +1093,10 @@
@ stub _snprintf_l
@ varargs _snprintf_s(ptr long long str) msvcrt._snprintf_s
@ stub _snprintf_s_l
@ stub _snscanf
@ stub _snscanf_l
@ stub _snscanf_s
@ stub _snscanf_s_l
@ varargs _snscanf(str long str) msvcrt._snscanf
@ varargs _snscanf_l(str long str ptr) msvcrt._snscanf_l
@ varargs _snscanf_s(str long str) msvcrt._snscanf_s
@ varargs _snscanf_s_l(str long str ptr) msvcrt._snscanf_s_l
@ varargs _snwprintf(ptr long wstr) msvcrt._snwprintf
@ stub _snwprintf_l
@ varargs _snwprintf_s(ptr long long wstr) msvcrt._snwprintf_s
......
......@@ -526,7 +526,7 @@
@ stub _setsystime
@ cdecl _sleep(long) msvcrt._sleep
@ varargs _snprintf(ptr long str) msvcrt._snprintf
@ stub _snscanf
@ varargs _snscanf(str long str) msvcrt._snscanf
@ varargs _snwprintf(ptr long wstr) msvcrt._snwprintf
@ stub _snwscanf
@ varargs _sopen(str long long) msvcrt._sopen
......
......@@ -522,7 +522,7 @@
@ cdecl _setsystime(ptr long) msvcrt._setsystime
@ cdecl _sleep(long) msvcrt._sleep
@ varargs _snprintf(str long str) msvcrt._snprintf
@ stub _snscanf
@ varargs _snscanf(str long str) msvcrt._snscanf
@ varargs _snwprintf(wstr long wstr) msvcrt._snwprintf
@ stub _snwscanf
@ varargs _sopen(str long long) msvcrt._sopen
......
......@@ -947,10 +947,10 @@
@ stub _snprintf_l
@ varargs _snprintf_s(ptr long long str) msvcrt._snprintf_s
@ stub _snprintf_s_l
@ stub _snscanf
@ stub _snscanf_l
@ stub _snscanf_s
@ stub _snscanf_s_l
@ varargs _snscanf(str long str) msvcrt._snscanf
@ varargs _snscanf_l(str long str ptr) msvcrt._snscanf_l
@ varargs _snscanf_s(str long str) msvcrt._snscanf_s
@ varargs _snscanf_s_l(str long str ptr) msvcrt._snscanf_s_l
@ varargs _snwprintf(ptr long wstr) msvcrt._snwprintf
@ stub _snwprintf_l
@ varargs _snwprintf_s(ptr long long wstr) msvcrt._snwprintf_s
......
......@@ -933,10 +933,10 @@
@ stub _snprintf_l
@ varargs _snprintf_s(ptr long long str) msvcrt._snprintf_s
@ stub _snprintf_s_l
@ stub _snscanf
@ stub _snscanf_l
@ stub _snscanf_s
@ stub _snscanf_s_l
@ varargs _snscanf(str long str) msvcrt._snscanf
@ varargs _snscanf_l(str long str ptr) msvcrt._snscanf_l
@ varargs _snscanf_s(str long str) msvcrt._snscanf_s
@ varargs _snscanf_s_l(str long str ptr) msvcrt._snscanf_s_l
@ varargs _snwprintf(ptr long wstr) msvcrt._snwprintf
@ stub _snwprintf_l
@ varargs _snwprintf_s(ptr long long wstr) msvcrt._snwprintf_s
......
......@@ -876,10 +876,10 @@
# stub _snprintf_l
@ varargs _snprintf_s(ptr long long str) MSVCRT__snprintf_s
# stub _snprintf_s_l
# stub _snscanf
# stub _snscanf_l
# stub _snscanf_s
# stub _snscanf_s_l
@ varargs _snscanf(str long str) MSVCRT__snscanf
@ varargs _snscanf_l(str long str ptr) MSVCRT__snscanf_l
@ varargs _snscanf_s(str long str) MSVCRT__snscanf_s
@ varargs _snscanf_s_l(str long str ptr) MSVCRT__snscanf_s_l
@ varargs _snwprintf(ptr long wstr) MSVCRT__snwprintf
# stub _snwprintf_l
@ varargs _snwprintf_s(ptr long long wstr) MSVCRT__snwprintf_s
......
......@@ -91,6 +91,16 @@ static int wchar2digit(MSVCRT_wchar_t c, int base) {
#define SECURE 1
#include "scanf.h"
/* vsnscanf_l */
#undef SECURE
#define STRING_LEN 1
#include "scanf.h"
/* vsnscanf_s_l */
#define SECURE
#include "scanf.h"
#undef STRING_LEN
/* vswscanf_l */
#define WIDE_SCANF 1
#undef CONSOLE
......@@ -582,3 +592,61 @@ int CDECL _cwscanf_s_l(const char *format, MSVCRT__locale_t locale, ...)
__ms_va_end(valist);
return res;
}
/*********************************************************************
* _snscanf (MSVCRT.@)
*/
int CDECL MSVCRT__snscanf(char *input, MSVCRT_size_t length, const char *format, ...)
{
__ms_va_list valist;
int res;
__ms_va_start(valist, format);
res = MSVCRT_vsnscanf_l(input, length, format, NULL, valist);
__ms_va_end(valist);
return res;
}
/*********************************************************************
* _snscanf_l (MSVCRT.@)
*/
int CDECL MSVCRT__snscanf_l(char *input, MSVCRT_size_t length,
const char *format, MSVCRT__locale_t locale, ...)
{
__ms_va_list valist;
int res;
__ms_va_start(valist, locale);
res = MSVCRT_vsnscanf_l(input, length, format, locale, valist);
__ms_va_end(valist);
return res;
}
/*********************************************************************
* _snscanf_s (MSVCRT.@)
*/
int CDECL MSVCRT__snscanf_s(char *input, MSVCRT_size_t length, const char *format, ...)
{
__ms_va_list valist;
int res;
__ms_va_start(valist, format);
res = MSVCRT_vsnscanf_s_l(input, length, format, NULL, valist);
__ms_va_end(valist);
return res;
}
/*********************************************************************
* _snscanf_s_l (MSVCRT.@)
*/
int CDECL MSVCRT__snscanf_s_l(char *input, MSVCRT_size_t length,
const char *format, MSVCRT__locale_t locale, ...)
{
__ms_va_list valist;
int res;
__ms_va_start(valist, locale);
res = MSVCRT_vsnscanf_s_l(input, length, format, locale, valist);
__ms_va_end(valist);
return res;
}
......@@ -65,6 +65,23 @@
#ifdef STRING
#undef _EOF_
#define _EOF_ 0
#ifdef STRING_LEN
#define _GETC_(file) (consumed==length ? '\0' : (consumed++, *file++))
#define _UNGETC_(nch, file) do { file--; consumed--; } while(0)
#ifdef WIDE_SCANF
#ifdef SECURE
#define _FUNCTION_ static int MSVCRT_vsnwscanf_s_l(const MSVCRT_wchar_t *file, MSVCRT_size_t length, const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list ap)
#else /* SECURE */
#define _FUNCTION_ static int MSVCRT_vsnwscanf_l(const MSVCRT_wchar_t *file, MSVCRT_size_t length, const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list ap)
#endif /* SECURE */
#else /* WIDE_SCANF */
#ifdef SECURE
#define _FUNCTION_ static int MSVCRT_vsnscanf_s_l(const char *file, MSVCRT_size_t length, const char *format, MSVCRT__locale_t locale, __ms_va_list ap)
#else /* SECURE */
#define _FUNCTION_ static int MSVCRT_vsnscanf_l(const char *file, MSVCRT_size_t length, const char *format, MSVCRT__locale_t locale, __ms_va_list ap)
#endif /* SECURE */
#endif /* WIDE_SCANF */
#else /* STRING_LEN */
#define _GETC_(file) (consumed++, *file++)
#define _UNGETC_(nch, file) do { file--; consumed--; } while(0)
#ifdef WIDE_SCANF
......@@ -80,6 +97,7 @@
#define _FUNCTION_ static int MSVCRT_vsscanf_l(const char *file, const char *format, MSVCRT__locale_t locale, __ms_va_list ap)
#endif /* SECURE */
#endif /* WIDE_SCANF */
#endif /* STRING_LEN */
#else /* STRING */
#ifdef WIDE_SCANF
#define _GETC_(file) (consumed++, MSVCRT_fgetwc(file))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment