mirror of
https://github.com/git/git.git
synced 2026-04-02 04:50:12 +02:00
Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++
The Microsoft C runtime's vsnprintf function does not add NUL at the end of the buffer. Further, Microsoft deprecated vsnprintf in favor of _vsnprintf, so add a #define to that end. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
1edac2172d
commit
8d7c8c95b6
@@ -6,7 +6,7 @@
|
||||
* number of characters to write without the trailing NUL.
|
||||
*/
|
||||
#ifndef SNPRINTF_SIZE_CORR
|
||||
#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4
|
||||
#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4 || defined(_MSC_VER)
|
||||
#define SNPRINTF_SIZE_CORR 1
|
||||
#else
|
||||
#define SNPRINTF_SIZE_CORR 0
|
||||
@@ -14,6 +14,11 @@
|
||||
#endif
|
||||
|
||||
#undef vsnprintf
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
||||
int git_vsnprintf(char *str, size_t maxsize, const char *format, va_list ap)
|
||||
{
|
||||
char *s;
|
||||
|
||||
Reference in New Issue
Block a user