From 18b857b9bd4545df93b3493bfa8ad09962e00885 Mon Sep 17 00:00:00 2001 From: Rui Abreu Ferreira Date: Sun, 3 May 2015 13:19:50 +0100 Subject: [PATCH] windows: MSVC 2015 has snprintf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to MSVC 2015, there was no standard compliant snprintf(), added a compiler version check and disabled the snprintf() replacement for MSVC >= 2015 in test/task.h. PR-URL: https://github.com/libuv/libuv/pull/341 Reviewed-By: Saúl Ibarra Corretgé --- test/task.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/task.h b/test/task.h index ea0503e8..e06a50e2 100644 --- a/test/task.h +++ b/test/task.h @@ -184,7 +184,8 @@ enum test_status { # define inline __inline # endif -/* Emulate snprintf() on Windows, _snprintf() doesn't zero-terminate the buffer +# if defined(_MSC_VER) && _MSC_VER < 1900 +/* Emulate snprintf() on MSVC<2015, _snprintf() doesn't zero-terminate the buffer * on overflow... */ inline int snprintf(char* buf, size_t len, const char* fmt, ...) { @@ -205,6 +206,7 @@ inline int snprintf(char* buf, size_t len, const char* fmt, ...) { return n; } +# endif #endif