windows: _snprintf_s
authorRenyaow <renyaow@user.github.invalid.com>
Tue, 4 Apr 2017 17:55:38 +0000 (01:55 +0800)
committerAndy Green <andy@warmcat.com>
Tue, 4 Apr 2017 17:55:38 +0000 (01:55 +0800)
  https://github.com/warmcat/libwebsockets/issues/859

lib/libwebsockets.h

index 8be0054..ed716e8 100644 (file)
@@ -93,6 +93,10 @@ struct sockaddr_in;
 #define __func__ __FUNCTION__
 #endif
 
+#if !defined(__MINGW32__) &&(!defined(_MSC_VER) || _MSC_VER < 1900) && !defined(snprintf)
+#define snprintf(buf,len, format,...) _snprintf_s(buf, len,len, format, __VA_ARGS__)
+#endif
+
 #else /* NOT WIN32 */
 #include <unistd.h>