]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Use the proper snprintf function if compiling with VS2015.
authorSimon Tatham <anakin@pobox.com>
Sat, 19 Dec 2015 10:07:11 +0000 (10:07 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 22 Dec 2015 12:35:23 +0000 (12:35 +0000)
Proper snprintf is finally supported as of the latest Visual Studio,
and has better semantics for my purposes than the old MS-specific
_snprintf. (Specifically, if its output doesn't fit the buffer, it
returns the full size it _would_ have wanted, so that you can then
immediately allocate that much space, and don't have to keep going
round a loop increasing the buffer size until you find the answer.)

misc.c

diff --git a/misc.c b/misc.c
index 0ce3d366824c24c472922eb681dbf1e12412aa4f..5ff403d6b495f60ef9f8a7daf7a7075ef28b5693 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -412,7 +412,7 @@ char *dupvprintf(const char *fmt, va_list ap)
     size = 512;
 
     while (1) {
-#ifdef _WINDOWS
+#if defined _WINDOWS && _MSC_VER < 1900 /* 1900 == VS2015 has real snprintf */
 #define vsnprintf _vsnprintf
 #endif
 #ifdef va_copy