Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/2] MSVC: vsnprintf in Visual Studio 2015 doesn't need SNPRINTF_SIZE_CORR any more

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:09:05

Sven Strickroth [off-list ref] writes:
In MSVC2015 the behavior of vsnprintf was changed.
W/o this fix there is one character missing at the end.

Signed-off-by: Sven Strickroth <redacted>
---
Thanks.

I am not qualified to judge the correctness of the assertion that
MSVC at or more recent than version 1900 does not need the
correction and will wait for Windows folks to Ack.

Thanks.
quoted hunk
 compat/snprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/snprintf.c b/compat/snprintf.c
index 42ea1ac..0b11688 100644
--- a/compat/snprintf.c
+++ b/compat/snprintf.c
@@ -9,7 +9,7 @@
  * always have room for a trailing NUL byte.
  */
 #ifndef SNPRINTF_SIZE_CORR
-#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4)
+#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4) && (!defined(_MSC_VER) || _MSC_VER < 1900)
 #define SNPRINTF_SIZE_CORR 1
 #else
 #define SNPRINTF_SIZE_CORR 0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help