Hi,
On 11/02/15 11:08, Martin Storsjo wrote:
@@ -724,12 +724,13 @@ int CDECL MSVCRT__stdio_common_vsprintf( unsigned __int64 options, char *str, MS struct _str_ctx_a ctx = {len, str}; int ret;
- if (options != UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION &&
options != UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR)
- if (options & ~UCRTBASE_PRINTF_TERMINATION_MASK) FIXME("options %s not handled\n", wine_dbgstr_longlong(options));
- ret = pf_printf_a(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR ? puts_clbk_str_c99_a : puts_clbk_str_a,
- ret = pf_printf_a(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION ? puts_clbk_str_a : puts_clbk_str_c99_a, &ctx, format, locale, FALSE, FALSE, arg_clbk_valist, NULL, &valist); puts_clbk_str_a(&ctx, 1, &nullbyte);
- if ((options & UCRTBASE_PRINTF_TERMINATION_MASK) == 0 && ret >= len)
}ret = -2; return ret;
This code looks like you're trying to make the things other way around. Shouldn't UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR flag impact the callback being used? On the other hand UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION flag should probably only affect terminating NULL related behavior.
Maybe following code makes more sense: ret = pf_printf_a(options & UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR ? puts_clbk_str_c99_a : puts_clbk_str_a, &ctx, format, locale, FALSE, FALSE, arg_clbk_valist, NULL, &valist); if(puts_clbk_str_a(&ctx, 1, &nullbyte)==-1 && !(options & UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION)) { if(len) str[len-1] = 0; return -2; } return ret;
What do you think about it?
Thanks, Piotr