[PATCH] libs/wine/string.c: Always return (int)written

Ricardo Filipe ricardojdfilipe at gmail.com
Wed Dec 17 07:48:42 CST 2014

2014-12-17 12:02 GMT+00:00 Hugh McMaster <hugh.mcmaster at outlook.com>:
> On Wednesday, Dec 17 05:54:42 CST 2014, Jonathan Vollebregt wrote:
>>No: http://msdn.microsoft.com/en-us/library/1kt27hek.aspx#returnValueToggle
>>>  vsnprintf ,_vsnprintf, and _vsnwprintf return the number of characters written if the number of characters to write is less than or equal to count; if the number of characters to write is greater than count, these functions return -1 indicating that output has been truncated. The return value does not include the terminating null, if one is written.
>>> If buffer or format is NULL, or if count is less than or equal to zero, these functions invoke the invalid parameter handler, as described in Parameter Validation. If execution is allowed to continue, these functions return -1 and set errno to EINVAL.
> I disagree. vsnprintfW is not a Windows function. We should be following the Linux form here, which returns the number of chars that would be written.

vsnprintfW is the unicode version of vsnprintf, which is a Windows
function. see dlls/user32/wsprintf.c for the Windows implementation

More information about the wine-devel mailing list