在 2020/3/10 20:09, Martin Storsjö 写道:
> 
> Yes, it is. The UCRT in modern WinSDK doesn't have any vsnwprintf
> function at all - so ideally we probably shouldn't have one either
> (unless users of mingw-w64 have started using i).
> 
> In this case, the swprintf.inl header forwards calls from swprintf to
> vswprintf, which forwards them onwards to vsnwprintf. These codepaths
> are shared between msvcrt.dll and UCRT at the moment, with vsnwprintf
> being the actual implementation for swprintf/vswprintf. So with that,
> it's probably fine to have vsnwprintf have the behaviour of vswprintf.
> 
> Sorting out this mess probably would be welcome, but I think that's
> orthogonal to this patch.
> 

I suspect that `UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR` controls
what to return (the number of characters that would have been written in
case of insufficient space, or a negative value) and whether a null
terminator is added. According to [1], `snprintf()` seems the only
exception, so removal of `UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR`
should suffice. May I ask, what is the purpose of normalization of
negative return values to -1?


[1]
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=vs-2019


-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to