Commit f443a72d by Russell Belfer

Fix some deprecation warnings on Windows

This fixes some snprintf and vsnprintf related deprecation
warnings we've been having on Windows with recent compilers.
parent 97b71374
......@@ -33,11 +33,9 @@
# include "win32/pthread.h"
#endif
# define snprintf _snprintf
#else
# include <unistd.h>
# include <unistd.h>
# ifdef GIT_THREADS
# include <pthread.h>
# endif
......
......@@ -37,6 +37,13 @@
/* MSVC doesn't define ssize_t at all */
typedef SSIZE_T ssize_t;
/* define snprintf using variadic macro support if available */
#if _MSC_VER >= 1400
# define snprintf(BUF, SZ, FMT, ...) _snprintf_s(BUF, SZ, _TRUNCATE, FMT, __VA_ARGS__)
#else
# define snprintf _snprintf
#endif
#endif
#define GIT_STDLIB_CALL __cdecl
......
......@@ -375,7 +375,8 @@ int p_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
#ifdef _MSC_VER
int len;
if (count == 0 || (len = _vsnprintf(buffer, count, format, argptr)) < 0)
if (count == 0 ||
(len = _vsnprintf_s(buffer, count, _TRUNCATE, format, argptr)) < 0)
return _vscprintf(format, argptr);
return len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment