Conditionally define snprintf on Windows
authorLucas Terra <lucasterra@users.noreply.github.com>
Mon, 18 Apr 2016 19:15:37 +0000 (16:15 -0300)
committerAndy Green <andy@warmcat.com>
Tue, 19 Apr 2016 00:23:13 +0000 (08:23 +0800)
snprintf is already defined in MSVC 2015. If you redefine it <stdio.h> will cry about it and abort the compilation.

lib/libwebsockets.h

index 5265dc9..4824dc2 100644 (file)
@@ -146,7 +146,9 @@ struct sockaddr_in;
 #define LWS_INVALID_FILE INVALID_HANDLE_VALUE
 #define LWS_O_RDONLY _O_RDONLY
 
+#if !defined(_MSC_VER) || _MSC_VER < 1900 /* Visual Studio 2015 already defines this in <stdio.h> */
 #define snprintf _snprintf
+#endif
 
 #else /* NOT WIN32 */
 #include <unistd.h>