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

Hugh McMaster hugh.mcmaster at outlook.com
Wed Dec 17 05:47:05 CST 2014


Both GCC and Windows versions of vsnprintf return the number of chars that would be written to a given buffer when vsnprintf(NULL, 0, fmt, va_args) is called.

Wine currently returns -1, which is incorrect.

Also, if there is a short buffer, that is, buffer <= len, not only is any output truncated, but the return value is the number of chars that would be written if the buffer had sufficient space.

Here, Wine returns -1, which is, again, incorrect.

In all cases, the return value should be the number of chars written or the number of chars that would be written if the buffer has sufficient space.
 		 	   		  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: string-return.patch
Type: application/octet-stream
Size: 792 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20141217/08a4d6b8/attachment-0001.obj>


More information about the wine-patches mailing list