[PATCH] libs/wine/string.c: Duplicate Windows behaviour in vsnprintfW

Chris Robinson chris.kcat at gmail.com
Fri Dec 19 08:45:57 CST 2014


On 12/19/2014 03:35 AM, Hugh McMaster wrote:
> On Thursday, 18 Dec 2014 18:09:01 +0100, Jonathan Vollebregt wrote:
>> Is there a test that shows the MSDN docs are wrong?
> I'm not sure if Wine has one, but I'll check. Running multiple tests
> with Visual Studio 2013 on Windows 7 64-bit returns the number of
> chars that would be written for vsnprintf(NULL, 0, fmt, args).
>
> -1 is returned in cases when "the number of characters to write is
> greater than count". So some examples would be vsnprintf(valid
> buffer, 0, fmt, args) or vsnprintf(very small buffer, 8, fmt, args).

Special-casing buff=NULL size=0 sounds like MS's attempt to add a bit 
more C99 compliance to the (v)snprintf functions, in addition to adding 
more C99 functions in general, which they've been talking about the last 
couple of years. This behavior may be different from older pre-VS2013 
versions.



More information about the wine-devel mailing list