msvcrt: Use printf and scanf flags from public header.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-11-30 14:37:33 +01:00 committed by Alexandre Julliard
parent babe6ceb7f
commit eb6f79f96a
4 changed files with 26 additions and 27 deletions

View File

@ -23,6 +23,7 @@
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <wchar.h> #include <wchar.h>
#include "windef.h" #include "windef.h"
@ -1020,23 +1021,21 @@ extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,
#define UNDNAME_NO_SPECIAL_SYMS (0x4000) #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
#define UNDNAME_NO_COMPLEX_TYPE (0x8000) #define UNDNAME_NO_COMPLEX_TYPE (0x8000)
#define UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION (0x0001) #define UCRTBASE_PRINTF_MASK ( \
#define UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR (0x0002) _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION | \
#define UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS (0x0004) _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR | \
#define UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY (0x0008) _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS | \
#define UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS (0x0010) _CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY | \
#define UCRTBASE_PRINTF_STANDARD_ROUNDING (0x0020) _CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS | \
_CRT_INTERNAL_PRINTF_STANDARD_ROUNDING )
#define UCRTBASE_PRINTF_MASK (0x003F)
#define MSVCRT_PRINTF_POSITIONAL_PARAMS (0x0100) #define MSVCRT_PRINTF_POSITIONAL_PARAMS (0x0100)
#define MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER (0x0200) #define MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER (0x0200)
#define UCRTBASE_SCANF_SECURECRT (0x0001) #define UCRTBASE_SCANF_MASK ( \
#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002) _CRT_INTERNAL_SCANF_SECURECRT | \
#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004) _CRT_INTERNAL_SCANF_LEGACY_WIDE_SPECIFIERS | \
_CRT_INTERNAL_SCANF_LEGACY_MSVCRT_COMPATIBILITY )
#define UCRTBASE_SCANF_MASK (0x0007)
#define COOPERATIVE_TIMEOUT_INFINITE ((unsigned int)-1) #define COOPERATIVE_TIMEOUT_INFINITE ((unsigned int)-1)
#define COOPERATIVE_WAIT_TIMEOUT ~0 #define COOPERATIVE_WAIT_TIMEOUT ~0

View File

@ -960,10 +960,10 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
BOOL positional_params = options & MSVCRT_PRINTF_POSITIONAL_PARAMS; BOOL positional_params = options & MSVCRT_PRINTF_POSITIONAL_PARAMS;
BOOL invoke_invalid_param_handler = options & MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER; BOOL invoke_invalid_param_handler = options & MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER;
#if _MSVCR_VER >= 140 #if _MSVCR_VER >= 140
BOOL legacy_wide = options & UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS; BOOL legacy_wide = options & _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS;
BOOL legacy_msvcrt_compat = options & UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY; BOOL legacy_msvcrt_compat = options & _CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY;
BOOL three_digit_exp = options & UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS; BOOL three_digit_exp = options & _CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS;
BOOL standard_rounding = options & UCRTBASE_PRINTF_STANDARD_ROUNDING; BOOL standard_rounding = options & _CRT_INTERNAL_PRINTF_STANDARD_ROUNDING;
#else #else
BOOL legacy_wide = TRUE, legacy_msvcrt_compat = TRUE; BOOL legacy_wide = TRUE, legacy_msvcrt_compat = TRUE;
BOOL three_digit_exp = MSVCRT__get_output_format() != MSVCRT__TWO_DIGIT_EXPONENT; BOOL three_digit_exp = MSVCRT__get_output_format() != MSVCRT__TWO_DIGIT_EXPONENT;

View File

@ -674,7 +674,7 @@ int CDECL MSVCRT__stdio_common_vsscanf(unsigned __int64 options,
* but parsing of those isn't implemented at all yet. */ * but parsing of those isn't implemented at all yet. */
if (options & ~UCRTBASE_SCANF_MASK) if (options & ~UCRTBASE_SCANF_MASK)
FIXME("options %s not handled\n", wine_dbgstr_longlong(options)); FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
if (options & UCRTBASE_SCANF_SECURECRT) if (options & _CRT_INTERNAL_SCANF_SECURECRT)
return MSVCRT_vsnscanf_s_l(input, length, format, locale, valist); return MSVCRT_vsnscanf_s_l(input, length, format, locale, valist);
else else
return MSVCRT_vsnscanf_l(input, length, format, locale, valist); return MSVCRT_vsnscanf_l(input, length, format, locale, valist);
@ -694,7 +694,7 @@ int CDECL MSVCRT__stdio_common_vswscanf(unsigned __int64 options,
* but parsing of those isn't implemented at all yet. */ * but parsing of those isn't implemented at all yet. */
if (options & ~UCRTBASE_SCANF_MASK) if (options & ~UCRTBASE_SCANF_MASK)
FIXME("options %s not handled\n", wine_dbgstr_longlong(options)); FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
if (options & UCRTBASE_SCANF_SECURECRT) if (options & _CRT_INTERNAL_SCANF_SECURECRT)
return MSVCRT_vsnwscanf_s_l(input, length, format, locale, valist); return MSVCRT_vsnwscanf_s_l(input, length, format, locale, valist);
else else
return MSVCRT_vsnwscanf_l(input, length, format, locale, valist); return MSVCRT_vsnwscanf_l(input, length, format, locale, valist);
@ -709,9 +709,9 @@ int CDECL MSVCRT__stdio_common_vfscanf(unsigned __int64 options,
_locale_t locale, _locale_t locale,
__ms_va_list valist) __ms_va_list valist)
{ {
if (options & ~UCRTBASE_SCANF_SECURECRT) if (options & ~_CRT_INTERNAL_SCANF_SECURECRT)
FIXME("options %s not handled\n", wine_dbgstr_longlong(options)); FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
if (options & UCRTBASE_SCANF_SECURECRT) if (options & _CRT_INTERNAL_SCANF_SECURECRT)
return MSVCRT_vfscanf_s_l(file, format, locale, valist); return MSVCRT_vfscanf_s_l(file, format, locale, valist);
else else
return MSVCRT_vfscanf_l(file, format, locale, valist); return MSVCRT_vfscanf_l(file, format, locale, valist);
@ -726,9 +726,9 @@ int CDECL MSVCRT__stdio_common_vfwscanf(unsigned __int64 options,
_locale_t locale, _locale_t locale,
__ms_va_list valist) __ms_va_list valist)
{ {
if (options & ~UCRTBASE_SCANF_SECURECRT) if (options & ~_CRT_INTERNAL_SCANF_SECURECRT)
FIXME("options %s not handled\n", wine_dbgstr_longlong(options)); FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
if (options & UCRTBASE_SCANF_SECURECRT) if (options & _CRT_INTERNAL_SCANF_SECURECRT)
return MSVCRT_vfwscanf_s_l(file, format, locale, valist); return MSVCRT_vfwscanf_s_l(file, format, locale, valist);
else else
return MSVCRT_vfwscanf_l(file, format, locale, valist); return MSVCRT_vfwscanf_l(file, format, locale, valist);

View File

@ -896,11 +896,11 @@ int CDECL __stdio_common_vsprintf( unsigned __int64 options, char *str, size_t l
if(!str) if(!str)
return ret; return ret;
if(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) if(options & _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION)
return ret>len ? -1 : ret; return ret>len ? -1 : ret;
if(ret>=len) { if(ret>=len) {
if(len) str[len-1] = 0; if(len) str[len-1] = 0;
if(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR) if(options & _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR)
return ret; return ret;
return len > 0 ? -2 : -1; return len > 0 ? -2 : -1;
} }
@ -1509,11 +1509,11 @@ int CDECL MSVCRT__stdio_common_vswprintf( unsigned __int64 options,
if(!str) if(!str)
return ret; return ret;
if(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) if(options & _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION)
return ret>len ? -1 : ret; return ret>len ? -1 : ret;
if(ret>=len) { if(ret>=len) {
if(len) str[len-1] = 0; if(len) str[len-1] = 0;
if(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR) if(options & _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR)
return ret; return ret;
return len > 0 ? -2 : -1; return len > 0 ? -2 : -1;
} }