mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-28 14:02:57 +00:00
Fix some deprecation warnings on Windows
This fixes some snprintf and vsnprintf related deprecation warnings we've been having on Windows with recent compilers.
This commit is contained in:
parent
97b7137459
commit
f443a72d33
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user