From eb6f79f96a81371d328476d255e27d3a47925b13 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 30 Nov 2020 14:37:33 +0100 Subject: [PATCH] msvcrt: Use printf and scanf flags from public header. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcrt/msvcrt.h | 25 ++++++++++++------------- dlls/msvcrt/printf.h | 8 ++++---- dlls/msvcrt/scanf.c | 12 ++++++------ dlls/msvcrt/wcs.c | 8 ++++---- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 43dad306e58..6c7d1c291d1 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #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_COMPLEX_TYPE (0x8000) -#define UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION (0x0001) -#define UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR (0x0002) -#define UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS (0x0004) -#define UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY (0x0008) -#define UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS (0x0010) -#define UCRTBASE_PRINTF_STANDARD_ROUNDING (0x0020) - -#define UCRTBASE_PRINTF_MASK (0x003F) +#define UCRTBASE_PRINTF_MASK ( \ + _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION | \ + _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR | \ + _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS | \ + _CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY | \ + _CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS | \ + _CRT_INTERNAL_PRINTF_STANDARD_ROUNDING ) #define MSVCRT_PRINTF_POSITIONAL_PARAMS (0x0100) #define MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER (0x0200) -#define UCRTBASE_SCANF_SECURECRT (0x0001) -#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002) -#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004) - -#define UCRTBASE_SCANF_MASK (0x0007) +#define UCRTBASE_SCANF_MASK ( \ + _CRT_INTERNAL_SCANF_SECURECRT | \ + _CRT_INTERNAL_SCANF_LEGACY_WIDE_SPECIFIERS | \ + _CRT_INTERNAL_SCANF_LEGACY_MSVCRT_COMPATIBILITY ) #define COOPERATIVE_TIMEOUT_INFINITE ((unsigned int)-1) #define COOPERATIVE_WAIT_TIMEOUT ~0 diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h index c3f833bffb9..bfcf0378793 100644 --- a/dlls/msvcrt/printf.h +++ b/dlls/msvcrt/printf.h @@ -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 invoke_invalid_param_handler = options & MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER; #if _MSVCR_VER >= 140 - BOOL legacy_wide = options & UCRTBASE_PRINTF_LEGACY_WIDE_SPECIFIERS; - BOOL legacy_msvcrt_compat = options & UCRTBASE_PRINTF_LEGACY_MSVCRT_COMPATIBILITY; - BOOL three_digit_exp = options & UCRTBASE_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS; - BOOL standard_rounding = options & UCRTBASE_PRINTF_STANDARD_ROUNDING; + BOOL legacy_wide = options & _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS; + BOOL legacy_msvcrt_compat = options & _CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY; + BOOL three_digit_exp = options & _CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS; + BOOL standard_rounding = options & _CRT_INTERNAL_PRINTF_STANDARD_ROUNDING; #else BOOL legacy_wide = TRUE, legacy_msvcrt_compat = TRUE; BOOL three_digit_exp = MSVCRT__get_output_format() != MSVCRT__TWO_DIGIT_EXPONENT; diff --git a/dlls/msvcrt/scanf.c b/dlls/msvcrt/scanf.c index 4deac62ac7f..a09619ed0e5 100644 --- a/dlls/msvcrt/scanf.c +++ b/dlls/msvcrt/scanf.c @@ -674,7 +674,7 @@ int CDECL MSVCRT__stdio_common_vsscanf(unsigned __int64 options, * 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)); - if (options & UCRTBASE_SCANF_SECURECRT) + if (options & _CRT_INTERNAL_SCANF_SECURECRT) return MSVCRT_vsnscanf_s_l(input, length, format, locale, valist); else 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. */ if (options & ~UCRTBASE_SCANF_MASK) 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); else 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, __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)); - if (options & UCRTBASE_SCANF_SECURECRT) + if (options & _CRT_INTERNAL_SCANF_SECURECRT) return MSVCRT_vfscanf_s_l(file, format, locale, valist); else return MSVCRT_vfscanf_l(file, format, locale, valist); @@ -726,9 +726,9 @@ int CDECL MSVCRT__stdio_common_vfwscanf(unsigned __int64 options, _locale_t locale, __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)); - if (options & UCRTBASE_SCANF_SECURECRT) + if (options & _CRT_INTERNAL_SCANF_SECURECRT) return MSVCRT_vfwscanf_s_l(file, format, locale, valist); else return MSVCRT_vfwscanf_l(file, format, locale, valist); diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 55f6dcd5530..e494d45e003 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -896,11 +896,11 @@ int CDECL __stdio_common_vsprintf( unsigned __int64 options, char *str, size_t l if(!str) return ret; - if(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) + if(options & _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) return ret>len ? -1 : ret; if(ret>=len) { if(len) str[len-1] = 0; - if(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR) + if(options & _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR) return ret; return len > 0 ? -2 : -1; } @@ -1509,11 +1509,11 @@ int CDECL MSVCRT__stdio_common_vswprintf( unsigned __int64 options, if(!str) return ret; - if(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) + if(options & _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION) return ret>len ? -1 : ret; if(ret>=len) { if(len) str[len-1] = 0; - if(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR) + if(options & _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR) return ret; return len > 0 ? -2 : -1; }